Partager via


Get-SCVMHost

Get-SCVMHost

Gets virtual machine host objects from the VMM 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

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
-- VMware ESX
-- Citrix XenServer

For more information about virtual machine hosts in VMM, 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
-- NetBIOS 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 (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

Example 1: Get all hosts managed by a VMM server

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

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

Example 2: Get a host by name

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

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

Example 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 then stores the object in the $HostGroup variable.

The second command gets all host objects in the host group stored in $HostGroup, and then 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

Example 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 then stores the object in the $Cluster variable.

The second command gets all host objects in Cluster01, and then 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

Example 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 then 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

Disable-SCVMHost

Enable-SCVMHost

Move-SCVMHost

New-SCVMHost

Read-SCVMHost

Register-SCVMHost

Remove-SCVMHost

Repair-SCVMHost

Restart-SCVMHost

Set-SCVMHost

Start-SCVMHost

Stop-SCVMHost

Get-SCVMHostGroup

Get-SCVMHostCluster