How to Delete Many VDI and Their Accounts by Using PowerShell Command

How to Delete Many VDI and Their Accounts by Using PowerShell Command

book

Article ID: CTX286861

calendar_today

Updated On:

Description

This article is designed to describe how to remove a machine from machine catalog as well as hypervisor through PowerShell command.


Instructions

  1. Run PowerShell in any DDC and load Citrix modules by the following command
asnp Citrix*
  1. Remove the machine from delivery group by the following command
Get-BrokerMachine -MachineName "domain\vmname" | Remove-BrokerMachine -Desktopgroup "delivery gorup name"
  1. Unlock the machine by the following command
Get-provvm -ProvisioningSchemeName "provisioningSchemeName" | unlock-provvm
  1. Delete the machine from hypervisor by the following command
Get-Provvm -vmname "vmname" | Remove-provvm
  1. Remove the machine from machine catalog by the following command
Get-BrokerMachine "domain\vmname" | Remove-BrokerMachine
  1. Get the information about AD acount by the following command
Get-AcctADAccount | select IdentityPoolName, ADAccountSid
  1. Delete AD account of the machine by the following command
Remove-AcctADAccount -ADAccountSid "ADAccountSID is from above step" -IdentityPoolName "Identitypoolname is from above step" -RemovalOption "delete"