Removing Citrix Zone Objects

Removes the specified Citrix Zone object(s).


Examples:


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


Remove the Citrix Zone object "Chicago" in the context of the Farm "XA65Farm" underneath "Managed Users & Computers\solys.local\Citrix\XenApp":


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


This removes the Citrix Zone "London" in the current context:


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

Remove-EmdbCitrixZone "London""


Hint: Citrix Zones that have Computer child objects, can not be deleted using only the cmdlet Remove-EmdbCitrixZone. In this case the standard cmdlet Remove-EmdbCitrixZone 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-EmdbCitrixZone "London" -RecurseRemove


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


$MyZone = Get-EmdbCitrixZone "emdb:\rootDSE\Managed Users & Computers\solys.local\Citrix\XenApp\XA65Farm\Paris"

$MyZone.Delete()


Hint:  Citrix Zones that have Computer child objects, 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 Zone "Munich" incl. its child objects using the cmdlet Remove-Item:


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


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


Starting with PSX 3.1 there was a new option implemented when deleting Citrix Zone 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.