Get-SCVirtualMachine

Gets virtual machine objects.

Syntax

Get-SCVirtualMachine [[-Name] <String>] [-All] [-OnBehalfOfUser <String>] [-OnBehalfOfUserRole <UserRole>]
 [-VMMServer <ServerConnection>] [<CommonParameters>]
Get-SCVirtualMachine [[-Name] <String>] -Cloud <Cloud> [-OnBehalfOfUser <String>]
 [-OnBehalfOfUserRole <UserRole>] [-VMMServer <ServerConnection>] [<CommonParameters>]
Get-SCVirtualMachine [[-Name] <String>] -ComputerTier <ComputerTier> [-OnBehalfOfUser <String>]
 [-OnBehalfOfUserRole <UserRole>] [-VMMServer <ServerConnection>] [<CommonParameters>]
Get-SCVirtualMachine [[-Name] <String>] [-ID <Guid>] [-OnBehalfOfUser <String>]
 [-OnBehalfOfUserRole <UserRole>] [-VMMServer <ServerConnection>] [<CommonParameters>]
Get-SCVirtualMachine [[-Name] <String>] [-OnBehalfOfUser <String>] [-OnBehalfOfUserRole <UserRole>]
 -Service <Service> [-VMMServer <ServerConnection>] [<CommonParameters>]
Get-SCVirtualMachine [[-Name] <String>] [-OnBehalfOfUser <String>] [-OnBehalfOfUserRole <UserRole>]
 -StorageQoSPolicy <StorageQoSPolicy> [-VMMServer <ServerConnection>] [<CommonParameters>]
Get-SCVirtualMachine [[-Name] <String>] [-OnBehalfOfUser <String>] [-OnBehalfOfUserRole <UserRole>]
 -VMHost <Host> [-VMMServer <ServerConnection>] [<CommonParameters>]

Description

The Get-SCVirtualMachine cmdlet gets one or more virtual machine objects from the Virtual Machine Manager (VMM) database. This cmdlet gets virtual machines that are deployed on a virtual machine host or stored in the VMM library.

Examples

Example 1: Get all virtual machines and display information about each one

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

This command gets all virtual machine objects on VMMServer01, and displays information about these virtual machine objects.

Example 2: Get all virtual machines and display information about specific properties

PS C:\> Get-SCVirtualMachine -VMMServer "VMMServer01.Contoso.com" | Format-List -Property Name, Owner, Description, HostName, OperatingSystem, CPUCount, Memory

This command gets all virtual machine objects on VMMServer01, and displays the values of the specified properties.

Example 3: Get a virtual machine by name that is stored on a specified library server

PS C:\> Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com"
PS C:\> Get-SCVirtualMachine | Where-Object { $_.Name -Eq "VM02" -And $_.LibraryServer -Eq "LibraryServer01" } | Select-Object Name,LibraryServer,Status

The first command connects to VMMServer01.

The second command gets the virtual machine object named VM02 stored on LibraryServer01, and then displays the virtual machine name, the name of the library server, and the status of the virtual machine.

Example 4: Get all virtual machines on the specified host

PS C:\> Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com"
PS C:\> Get-SCVirtualMachine -VMHost "VMHost01.Contoso.com"

The first command connects to VMMServer01.

The second command gets all virtual machine objects deployed on VMHost01, and displays information about these virtual machines.

Parameters

-All

Indicates that this cmdlet gets all subordinate objects independent of the parent object. For example, the command Get-SCVirtualDiskDrive -All gets all virtual disk drive objects regardless of the virtual machine object or template object that each virtual disk drive object is associated with.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Cloud

Specifies a private cloud object.

Type:Cloud
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ComputerTier

Specifies a computer tier object.

Type:ComputerTier
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ID

Specifies the unique ID for an object.

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

Specifies the name of a VMM object.

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

Specifies a user name. This cmdlet operates on behalf of the user that this parameter specifies.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-OnBehalfOfUserRole

Specifies a user role. To obtain a user role, use the Get-SCUserRole cmdlet. This cmdlet operates on behalf of the user role that this parameter specifies.

Type:UserRole
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Service

Specifies a VMM service object.

Type:Service
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-StorageQoSPolicy

Specifies the Quality of Service (QoS) policy for the virtual machines that this cmdlet gets.

Type:StorageQoSPolicy
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-VMHost

Specifies a virtual machine host object. VMM supports Hyper-V hosts, VMware ESX hosts, and Citrix XenServer hosts.

For more information about each type of host, see the Add-SCVMHost cmdlet.

Type:Host
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-VMMServer

Specifies a VMM server object.

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

Outputs

VirtualMachine

This cmdlet returns a **VirtualMachine** object.