Jump to content
Welcome to our new Citrix community!
  • 0

Deleting multiple machine from catalog via script with import txt server list file

sid van


Hello good day,


I have trying to delete a list of VDI in Xendesktop 1912 by using a powershell script.

To speed things up,  I have list of servers to be deleted put into a serverlist.txt.

Now I would like to generate a script that reads from that serverlist.txt (previously i added the servernames  into that list)   


The following has to be done:


Put the affected servers in maintance mode and show result on screen that servers are in maintance mode and press a key to continue   and shutdown the servers and show result on screen.

After that delete the servers from catalog and show result of the deletion of servers to a a file  for example  deleted-servers.txt. 


I have some code but some parts are missing:


#================================================= ========= #
# Get server list from serverlist.txt
#================================================= =========


Get-Content C:\serverlist.txt

foreach ($machine in $machines) {Set-BrokerMachineMaintenanceMode -InputObject $machine $true}


#================================================= ========= #
# How status of maintance status of servers on screen and press any key to continue
#================================================= =========

->> how can I get the result of the maintance status of the servers on screen?


Get-BrokerMachine -MachineName  xxxx  | fl InMaintenanceMode  ?

Pause and press any key to continue



#================================================= ========= #
#  Delete the affected servers from Catalog and write result to deleted-VDI.txt
#================================================= =========


Remove-BrokerMachine  -MachineName  xxxxx


Write results to file of deleted servers


Please help .. thanks in advance


Link to comment

1 answer to this question

Recommended Posts

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