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


    cugcblogs

    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.

    ott020619-01.png.f3dab1fa4bdaa21296c8cfc2d6604238.png

    This deletes all versions associated with it, so versions 33 through 37.

    ott020619-02.png.3e2d34bbb85446ccfdaf57962b63aafb.png

    If I look at the file system I still see some files associated with older versions of the vDisk.

    ott020619-03.png.b6e63f45c3006d3d283d96b3d5ef1675.png

    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.

    Requirements:

    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
    ott020619-04.png.bac12f4eae351e7994e2d6fe7d696544.png
    1. After selecting the files and hitting OK it will delete the obsolete files - displaying the verbose information on the screen
    ott020619-05.png.67a132d87c6aaf5042d031790993298b.png

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