Retrieving Virtualization-Management Server

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


Examples:


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


This code retrieves the Virtualization-Management Server "vCenterSrv01" from the Organizational Unit "ESXFarms":


Get-EmdbVirtualizationManagementServer "emdb:\rootDSE\Managed Virtual Environments\ESXFarms\vCenterSrv01"


The following command returns all Virtualization-Management Servers from the Organizational Unit "Hyper-V":


Get-EmdbVirtualizationManagementServer "emdb:\rootDSE\Managed Virtual Environments\Hyper-V\*"


The example below retrieves all Virtualization-Management Servers having a name beginning with "Test" from  the Virtual Environments tree and all subordinated Organizational Units:


Get-EmdbVirtualizationManagementServer "emdb:\rootDSE\Managed Virtual Environments\TEST*" -Recurse


The snippet below retrieves the Virtualization-Management Server "Cluster Frankfurt" from the current context:


Cd "emdb:\rootDSE\Managed Virtual Environments\ESX Clusters"

Get-EmdbVirtualizationManagementServer "Cluster Frankfurt"


Retrieve the Virtualization-Management Server "VSPHERE01" in the current context through its Item-ID (this ID will vary in different DSM environments):


Get-EmdbVirtualizationManagementServer -ItemID 2342 -Recurse


Tip: the alias ID can be used instead of ItemID.


And this code retrieves the Virtualization-Management Server "HVCluster" from the current context using the Get-Item cmdlet:


Cd "emdb:\rootDSE\Managed Virtual Environments\Hyper-V Clusters"

Get-Item "HVCluster"


Using the Get-ChildItem cmdlet, the following command retrieves all Virtualization-Management Server objects, having a name beginning with "ESX" from  the Virtual Environments tree and all subordinated Organizational Units:


Get-ChildItem "emdb:\rootDSE\Managed Virtual Environments" -Filter "&(Name=ESX*)(SchemaTag=VirtualizationManagementServer)" -Recurse


Starting with PSX 3.1 there was a new option implemented when retrieving Virtualization-Management Server objects. When specifying the SingleItemExpected-switch it is expected, that none or exactly one object is contained in the result. If the retrieval returns more than one object, an error is raised that can be caught and handled in scripts.