by David Ott
*Edited 2/19/2019 to fix a bug with version 0
*Edited 2/20/2019 to support remote file shares (thanks to Chuck Davis for the help!)
Have you ever noticed that sometimes Provisioning Server doesn’t always remove the files from the store after you delete a version of a vDisk? For instance, I recently deleted a very old vDisk version (33) which was an old base.
This deletes all versions associated with it, so versions 33 through 37.
If I look at the file system I still see some files associated with older versions of the vDisk.
I don’t want to sync unnecessary files between my provisioning servers. I also don’t want to check for the leftover files manually, as it takes longer, and leaves room for error.
I decided to write a little script to take care of these pesky files for me. Most of what you need to know is in the script comments.
- Run from Provisioning Server
- Run as Administrator
What the script does:
- Gets info on all vDisks
- For each vDisk it will get the root store directory for each PVS server, the base file name, and the lowest version number
- Uses the information from step 2 to find any files in the stores with the same base file name and any version that is not in the vDisks version list
- After running through all vDisks it will display a grid for you to select the files you wish to delete
- After selecting the files and hitting OK it will delete the obsolete files – displaying the verbose information on the screen
Disclaimer: You should always test scripts in a test environment before using them in production.