I'm trying to delete a machine in XenDesktop from a Catalog with bunch of machines in different states via powershell. Went through the reference list of commands http://support.citrix.com/static/kc/CTX127254/help/, tried bunch of stuff, but couldn't find a solution. Is it even possible?
I'm thinking on making a workaround by Creating a dummy catalog, placing the machine there and then deleting the whole catalog as "The Remove-BrokerCatalog cmdlet deletes catalogs from the site. A catalog containing one or more machines that are members of desktop groups cannot be deleted." Haven't tested it yet though.
This is what I'm doing at the moment and the outcome is that machine is deleted from PVS and is hanging in the Catalog with only Catalog and Power State information. Any and all ideas are welcome.
# Remove user from the machine
Remove-BrokerUser $userDomain"\"$userName -Machine $simpleDomain"\"$server
# Remove Device from Domain
Mcli-Run RemoveDeviceFromDomain -p deviceName=$server, OrganizationUnit=$ou, Domain=$domain
# Remove Device from Desktop group
Remove-BrokerMachine -MachineName $simpledomain"\"$server -Force -DesktopGroup $desktopGroupName -AdminAddress $dccName
# Mark Device as Down in PVS
Mcli-Run MarkDown -p deviceMac=$mdevice
# Delete Device from PVS
mcli-delete device -p deviceMac=$mdevice
Solution is to use the same command without defining the desktopGroup, which will then delete the machine from the Catalog.
# Remove Device from the Catalog
Remove-BrokerMachine -MachineName $simpledomain"\"$server -Force -AdminAddress $dccName