Provisioning Server vDisk Cleanup PowerShell Script

By David Ott posted 10 days ago


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.


  1. Run from Provisioning Server
  2. Run as Administrator

What the script does:

  1. Gets info on all vDisks
  2. For each vDisk it will get the root store directory for each PVS server, the base file name, and the lowest version number
  3. Uses the information from step 2 to find any files in the stores with the same base file name and a lower version than what PVS knows about
  4. After running through all vDisks it will display a grid for you to select the files you wish to deletepvsselectdelete.png
  5. 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.