Share via


Get-SCVirtualMachine

Gets virtual machine objects.

Syntax

All (Default)

Get-SCVirtualMachine
    [[-Name] <String>]
    [-VMMServer <ServerConnection>]
    [-All]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

VMHostGroup

Get-SCVirtualMachine
    [[-Name] <String>]
    -VMHost <Host>
    [-VMMServer <ServerConnection>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

Cloud

Get-SCVirtualMachine
    [[-Name] <String>]
    -Cloud <Cloud>
    [-VMMServer <ServerConnection>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

Service

Get-SCVirtualMachine
    [[-Name] <String>]
    -Service <Service>
    [-VMMServer <ServerConnection>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

ComputerTier

Get-SCVirtualMachine
    [[-Name] <String>]
    -ComputerTier <ComputerTier>
    [-VMMServer <ServerConnection>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

StorageQoSPolicy

Get-SCVirtualMachine
    [[-Name] <String>]
    -StorageQoSPolicy <StorageQoSPolicy>
    [-VMMServer <ServerConnection>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

ID

Get-SCVirtualMachine
    [[-Name] <String>]
    [-VMMServer <ServerConnection>]
    [-ID <Guid>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

All
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Cloud

Specifies a private cloud object.

Parameter properties

Type:Cloud
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Cloud
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputerTier

Specifies a computer tier object.

Parameter properties

Type:ComputerTier
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ComputerTier
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-ID

Specifies the unique ID for an object.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ID
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of a VMM object.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OnBehalfOfUser

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:UserRole
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Service

Specifies a VMM service object.

Parameter properties

Type:Service
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Service
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-StorageQoSPolicy

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

Parameter properties

Type:StorageQoSPolicy
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

StorageQoSPolicy
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:Host
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMHostGroup
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-VMMServer

Specifies a VMM server object.

Parameter properties

Type:ServerConnection
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

VirtualMachine

This cmdlet returns a VirtualMachine object.