Get-SCVirtualMachine
Gets virtual machine objects.
Syntax
Get-SCVirtualMachine
[-VMMServer <ServerConnection>]
[[-Name] <String>]
[-All]
[-OnBehalfOfUser <String>]
[-OnBehalfOfUserRole <UserRole>]
[<CommonParameters>]
Get-SCVirtualMachine
-VMHost <Host>
[-VMMServer <ServerConnection>]
[[-Name] <String>]
[-OnBehalfOfUser <String>]
[-OnBehalfOfUserRole <UserRole>]
[<CommonParameters>]
Get-SCVirtualMachine
[-VMMServer <ServerConnection>]
-Cloud <Cloud>
[[-Name] <String>]
[-OnBehalfOfUser <String>]
[-OnBehalfOfUserRole <UserRole>]
[<CommonParameters>]
Get-SCVirtualMachine
[-VMMServer <ServerConnection>]
-Service <Service>
[[-Name] <String>]
[-OnBehalfOfUser <String>]
[-OnBehalfOfUserRole <UserRole>]
[<CommonParameters>]
Get-SCVirtualMachine
[-VMMServer <ServerConnection>]
-ComputerTier <ComputerTier>
[[-Name] <String>]
[-OnBehalfOfUser <String>]
[-OnBehalfOfUserRole <UserRole>]
[<CommonParameters>]
Get-SCVirtualMachine
[-VMMServer <ServerConnection>]
-StorageQoSPolicy <StorageQoSPolicy>
[[-Name] <String>]
[-OnBehalfOfUser <String>]
[-OnBehalfOfUserRole <UserRole>]
[<CommonParameters>]
Get-SCVirtualMachine
[-VMMServer <ServerConnection>]
[[-Name] <String>]
[-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.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Cloud
Specifies a private cloud object.
Type: | Cloud |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ComputerTier
Specifies a computer tier object.
Type: | ComputerTier |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ID
Specifies the unique ID for an object.
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
Specifies the name of a VMM object.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | False |
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 |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Service
Specifies a VMM service object.
Type: | Service |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageQoSPolicy
Specifies the Quality of Service (QoS) policy for the virtual machines that this cmdlet gets.
Type: | StorageQoSPolicy |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
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 |
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
VirtualMachine
This cmdlet returns a VirtualMachine object.