top of page
  • Writer's pictureSantosh Kumar Behera

Difficulty in clearing inactive VMs from Dedicated VDI Pools? Not Anymore : )




Even though Dedicated VDI pools are rapidly being replaced by Floating pools, we still have few use cases which requires a Dedicated VM. Being a VDI Administrator it's really important to keep a check on these Dedicated pools and cleanup any unused VMs regularly to make sure the resources are being utilized where it's actually needed. It maybe a very time consuming or boring task to find all the VMs which are not being used and delete them to free up the resources. We can delete the VMs based on 2 criteria


  1. Delete VMs for disabled user accounts

  2. Delete VMs which are not used in last "N" number of days

Now, in this article we'll be covering the first point "Delete VMs for disabled user accounts"


We have written a very simple script which does the below list of tasks

  1. Get the list of all Dedicated Pools within the POD.

  2. Get the list of users who are having a VM Assigned/Dedicated to them in these pools.

  3. Check the user account against AD and check if the account is enabled or disabled.

  4. If the user account is disabled, then delete the VM assigned to the user.

  5. Write all the information in a log file.

  6. Note the username, PoolName and VM name for all the Deleted VMs in a CSV file and send it as email attachment to administrators.

Before you execute the script make sure you have imported all the Horizon Helper PowerCli Module from here - Horizon Helper Modules



**Script here**

87 views
bottom of page