Get-SCVirtualMachine

Applies To: System Center 2012 - Virtual Machine Manager

Get-SCVirtualMachine

Gets virtual machine objects.

Syntax

Parameter Set: All
Get-SCVirtualMachine [[-Name] <String> ] [-All] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: Cloud
Get-SCVirtualMachine [[-Name] <String> ] -Cloud <Cloud> [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: ComputerTier
Get-SCVirtualMachine [[-Name] <String> ] -ComputerTier <ComputerTier> [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: ID
Get-SCVirtualMachine [[-Name] <String> ] [-ID <Guid> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: Service
Get-SCVirtualMachine [[-Name] <String> ] -Service <Service> [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: VMHostGroup
Get-SCVirtualMachine [[-Name] <String> ] -VMHost <Host> [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Detailed Description

The Get-SCVirtualMachine cmdlet gets one or more virtual machine objects from the System Center Virtual Machine Manager (VMM) database. A virtual machine can be deployed on a virtual machine host or can be stored in the VMM library.

For more information about Get-SCVirtualMachine, type: "Get-Help Get-SCVirtualMachine -online".

Parameters

-All

Retrieves a full list of all subordinate objects independent of the parent object. For example, the command Get-SCVirtualDiskDrive -All retrieves all virtual disk drive objects regardless of the virtual machine object or template object that each virtual disk drive object is associated with.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Cloud<Cloud>

Specifies a private cloud object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-ComputerTier<ComputerTier>

Specifies a computer tier object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

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?

true (ByValue)

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of a VMM object.

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Service<Service>

Specifies a VMM service object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-VMHost<Host>

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, type: "Get-Help Add-SCVMHost -detailed". See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.

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.

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.

  • VirtualMachine

Examples

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

This command gets all virtual machine objects on VMMServer01 and displays information about these virtual machine objects to the user.

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

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

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

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

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

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 to the user.

PS C:\> Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com"
PS C:\> Get-SCVirtualMachine | where { $_.Name -eq "VM02" -and $_.LibraryServer -eq "LibraryServer01" } | select Name,LibraryServer,Status

4: Get all virtual machines on the specified host.

The first command connects to VMMServer01.

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

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

Move-SCVirtualMachine

New-SCVirtualMachine

Read-SCVirtualMachine

Remove-SCVirtualMachine

Repair-SCVirtualMachine

Resume-SCVirtualMachine

Save-SCVirtualMachine

Set-SCVirtualMachine

Start-SCVirtualMachine

Stop-SCVirtualMachine

Suspend-SCVirtualMachine