Get-SCVMHost

Get-SCVMHost

Gets virtual machine host objects from the Virtual Machine Manager database.

Syntax

Parameter Set: Connection
Get-SCVMHost [[-ComputerName] <String> ] [-ID <Guid> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: VMHostCluster
Get-SCVMHost [[-ComputerName] <String> ] -VMHostCluster <HostCluster> [ <CommonParameters>]

Parameter Set: VMHostGroup
Get-SCVMHost [[-ComputerName] <String> ] -VMHostGroup <HostGroup> [ <CommonParameters>]

Detailed Description

Gets one or more virtual machine host objects from the Virtual Machine Manager (VMM) database. Virtual machine hosts are physical computers that are managed by VMM on which you can deploy virtual machines.

Virltual Machine Manager supports the following types of hosts:

- Hyper-V hosts

- VMware ESX hosts

- Citrix XenServer hosts

For more information about virtual machine hosts in Virtual Machine Manager, type: "Get-Help Add-VMHost -detailed".

Parameters

-ComputerName<String>

Specifies the name of a computer that VMM can uniquely identify on your network. Valid formats are: FQDN, IPv4 or IPv6 address, or NetBIOS name.

NOTE: See the examples for a specific cmdlet to determine how that cmdlet specifies the computer name.

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ID<Guid>

Specifies the numerical identifier (as a globally unique identifier, or GUID) for a specific object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMHostCluster<HostCluster>

Specifies a VMM host cluster object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMHostGroup<HostGroup>

Specifies a virtual machine host group object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a VMM server object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Host

Examples

1: Get all hosts managed by the specified VMM server.

This command gets all host objects for all managed by VMMServer01 and displays the host properties to the user.

PS C:\> Get-SCVMHost -VMMServer "VMMServer01.Contoso.com"

2: Get a host by name.

This command gets the host object named VMHost01 in the Contoso.com domain and displays the host properties to the user.

PS C:\> Get-SCVMHost -ComputerName "VMHost01.Contoso.com"

3: Get all hosts in a specific host group and display information about them to the user.

The first command gets the host group object named HostGroup01 from VMMServer01 and stores the object in the $HostGroup variable.

The second command gets all host objects in the host group stored in $HostGroup and stores the objects in the $HostsInHG variable.

The last command uses the pipeline operator to pass all host objects stored in $HostsInHG to the Format-Table cmdlet, which displays the name of each host and the virtual machines deployed on that host in a table.

PS C:\> $HostGroup = Get-SCVMHostGroup -Name "HostGroup01" -VMMServer "VMMServer01.Contoso.com"
PS C:\> $HostsInHG = Get-SCVMHost -VMHostGroup $HostGroup
PS C:\> $HostsInHG | Format-Table -property Name, VMs

4: Get all hosts in a specific host cluster and display information about them to the user.

The first command gets the host cluster object named Cluster01 from VMMServer01 and stores the object in the $Cluster variable.

The second command gets all host objects in Cluster01 and stores the objects in the $HostsInCluster variable.

The last command passes all host objects stored in $HostsInCluster to the Format-Table cmdlet, which displays the name and virtualization platform of each host in Cluster01.

PS C:\> $Cluster = Get-SCVMHostCluster -Name "Cluster01.Contoso.com" -VMMServer "VMMServer01.Contoso.com"
PS C:\> $HostsInCluster = Get-SCVMHost -VMHostCluster $Cluster
PS C:\> $HostsInCluster | Format-Table -property Name, VirtualizationPlatform

5: Get a specific host located on a perimeter network by its IP address.

The first command gets the host object located on a perimeter network whose IP address is 10.199.53.5 from VMMServer01 and stores the object in the $VMHost variable.

The second command uses the pipeline operator to pass the host object in $VMHost to the Select-Object cmdlet, which displays the computer name and operating system for the host.

PS C:\> $VMHost = Get-VMHost -ComputerName 10.199.53.5 -VMMServer "VMMServer01.Contoso.com"
PS C:\> $VMHost | Select-Object -property ComputerName, OperatingSystem

Add-SCVMHost

Move-SCVMHost

Read-SCVMHost

Remove-SCVMHost

Set-SCVMHost