Today I published my xAzureTempDrive DSC Module to the PowerShell Gallery.
Gallery source: https://www.powershellgallery.com/packages/xAzureTempDrive
Github source: https://github.com/DdenBraver/xAzureTempDrive
This module contains a resource that will change the default temporary disk driveletter from the D-Drive to whatever you would like it to be.
In the past I have been struggling with this, since the Temp disk is always attached to the D-Drive by default.
Most application teams or customers would however like to use the D-Drive for their own data, (or other usage) and rather have it assigned to a T-drive or maybe even a Z-drive.
To be able to change this however, you would first need to remove the page file from the volume, then reboot the server, then change the driveletter, and then -if- you would like to go trough the hassle you’d have to change the pagefile back to the temporary drive again.
Well that is great, however now when Azure has maintenance or when you deallocate (stop) the VirtualMachine and start it again…. Well yeah it automatically gets a new Temporary disk and voila its attached to the first available driveletter once again!
This DSC resource will help you with that part.
Since its the nature of DSC, it will poll continuously and check for you (by using the assigned pagefile) what driveletter the pagefile has been assigned to.
If this is anything other then what you have defined, it will remove the pagefile, reboot the server, change the temporary disk driveletter, and then attach the pagefile to it again for you.
This way the driveletter will -always- remain on the driveletter you want it to be!
I hope you will enjoy this simple resource as much as I do, since I love it to see all those temporary disks having the same driveletter across all the servers in my domain 🙂