Jump to content
Welcome to our new Citrix community!
  • Provisioning Server vDisk Cleanup PowerShell Script


    davidottrnd.jpg 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.


    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 any version that is not in the vDisks version list
    4. After running through all vDisks it will display a grid for you to select the files you wish to delete
    1. 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.

    User Feedback

    Recommended Comments

    There are no comments to display.

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

  • Create New...