Removing Citrix Farm Objects

Removes the specified Citrix Farm object(s).


Examples:


Hint: The execution of these examples requires a connected PowerShell drive.


Remove the Citrix Farm object "Managed Users & Computers\solys.local\Citrix\XenApp\XA65Farm":


Remove-EmdbCitrixFarm "emdb:\rootDSE\Managed Users & Computers\solys.local\Citrix\XenApp\XA65Farm"


This removes the Citrix Farm "XA75 Farm" in the current context:


Cd "emdb:\rootDSE\Managed Users & Computers\solys.local\Citrix\XenApp"

Remove-EmdbCitrixFarm "XA75 Farm"


Hint: Citrix Farms that have child objects, e.g. Citrix Zone objects or Computers, can not be deleted using only the cmdlet Remove-EmdbCitrixFarm. In this case the standard cmdlet Remove-EmdbCitrixFarm parametrised with the switch parameter -RecurseRemove has to be used. If the RecurseRemove parameter is omitted, PowerShell waits for an interactive confirmation of the deletion of every child object.


Remove-EmdbCitrixFarm "XA75 Farm" -RecurseRemove


As an alternative method, the following shows the removing of a Citrix Farm using the Delete()-method:


$MyFarm = Get-EmdbCitrixFarm "emdb:\rootDSE\Managed Users & Computers\solys.local\Citrix\XenApp\XA75"

$MyFarm.Delete()


Hint:  Citrix Farms that have child objects, e.g. Citrix Zone objects or Computers, can not be deleted using the method Delete(). In this case the standard cmdlet Remove-Item parametrised with the switch parameter -Recurse has to be used. If the switch parameter is omitted, PowerShell waits for an interactive confirmation of the deletion of every child object.


Remove the Citrix Farm "XA75" incl. its child objects using the cmdlet Remove-Item:


Remove-Item "emdb:\rootDSE\Managed Users & Computers\solys.local\Citrix\XenApp\XA75" -Recurse


Hint: Alternatively the alias DEL can be used to remove Citrix Farm objects.


Starting with PSX 3.1 there was a new option implemented when deleting Citrix Farm objects. When specifying the SingleItemExpected-switch it is expected, that none or exactly one object is affected. If the command would delete more than one object, an error is raised that can be caught and handled in scripts.