Removing Virtualization-Management Server

Removes the specified Virtualization-Management Server object(s).


Examples:


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


The following example deletes the Virtualization-Management Server "vCenter01" in the context "Virtual Environments\ESXFarms" using the Remove-EmdbVirtualizationManagementServer cmdlet:


Remove-EmdbVirtualizationManagementServer "emdb:\rootDSE\Managed Virtual Environments\ESXFarms\vCenter01"


Without specifying the path, the command below deletes the Virtualization-Management Server "vCenter02" in the current context:


cd "emdb:\rootDSE\Managed Virtual Environments\ESXFarms"

Remove-EmdbVirtualizationManagementServer "vCenter02"


Alternatively, the the following snippet deletes a Virtualization-Management Server object named "vCenter03" in the context "Virtual Environments\ESXFarms" by utilizing the object's Delete()-Method:


$MyVirtMgmtServer = Get-EmdbVirtualizationManagementServer "emdb:\rootDSE\Managed Virtual Environments\ESXFarms\vCenter03"

$MyVirtMgmtServer.Delete()


A third way of deleting Virtualization-Management Servers by using the Remove-Item cmdlet is shown in the following example:


Remove-Item "emdb:\rootDSE\Managed Virtual Environments\Hyper-V\SCVMM01"


Hint: Alternatively the alias DEL can be used to remove Virtualization-Management Server objects.


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