Get-SCVMHost

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

Syntax

Get-SCVMHost
   [-VMMServer <ServerConnection>]
   [[-ComputerName] <String>]
   [-ID <Guid>]
   [<CommonParameters>]
Get-SCVMHost
   -VMHostGroup <HostGroup>
   [[-ComputerName] <String>]
   [<CommonParameters>]
Get-SCVMHost
   -VMHostCluster <HostCluster>
   [[-ComputerName] <String>]
   [<CommonParameters>]

Description

The Get-SCVMHost cmdlet 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.

VMM 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.

Examples

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

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

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

Example 2: Get a host by name

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

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

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

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

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.

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

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

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.

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

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

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.

Parameters

-ComputerName

Specifies the name of a computer that VMM can uniquely identify on your network. Valid formats are:

  • FQDN
  • IPv4 or IPv6 address
  • NetBIOS name

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

Type:String
Position:0
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ID

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

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VMHostCluster

Specifies a VMM host cluster object.

Type:HostCluster
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMHostGroup

Specifies a virtual machine host group object.

Type:HostGroup
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMMServer

Specifies a VMM server object.

Type:ServerConnection
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Outputs

Host

This cmdlet returns a Host object.