Image may be NSFW.
Clik here to view.For those Virtual Machine Administrators who would like to leverage the PowerShell engine and the SCVMM CmdLets for management outside the SCVMM console, we have these options documented in the following guides:
System Center Virtual Machine Manager 2008 Cmdlet Reference: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=58e79a68-cea8-4e73-840f-cdd8feb9de87
System Center Virtual Machine Manager 2008 R2 Cmdlet Reference: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=08a9eeb9-86ff-4a4f-8dfa-165bd701aba9
Often users will want to build upon these cmdlets to create their own custom queries for collecting data related to the state of Hosts and Virtual machines for reporting purposes or similar reasons. For example, I was recently working with a user who wanted to create custom queries with the PowerShell engine to perform tasks such as capturing information for a running virtual machine, weeding out duplicate virtual machine records, or simply wanting another format for viewing interval-based lists for Virtual Machines or Hosts in specific states. To do this, it would be helpful to understand what all of the possible values are of the “Status” option returned by the get-vm and get-host commands. The following is a list of response options for Virtual Machine and Host “Status” when using the “Get-VM” and “Get-Host” CmdLets:
Cmdlet response parameters for VM Status
- CreationFailed
- CustomizationFailed
- Deleting
- DeletingCheckpoint
- HostNotResponding
- IncompleteVMConfig
- MergingDrives
- MigrationFailed
- Missing
- P2VCreationFailed
- V2VCreationFailed
- Paused
- PoweringOff
- PowerOff
- RecoveringCheckpoint
- CheckpointFailed (Checkpoint action failed)
- Restoring
- Running
- Saved
- Saving
- Starting
- Stored
- TemplateCreationFailed (Sysprep Failed)
- UnderCreation
- UnderMigration
- UnderTemplateCreation (Sysprepping...)
- UnderUpdate
- Unsupported (Unsupported Undo Disk)
- UpdateFailed
Cmdlet response for Host Status
- Adding
- NotResponding
- Reassociating
- Removing
- Updating
- Pending
- MaintenanceMode
- NeedsAttention
- OK
- Limited
NOTE: Items in parentheses are only explanations and not part of the response.
Examples of Usage
Use of these status responses can be implemented in a CmdLet incorporated with a WHERE statement as in the syntax example below:
Get-VM -VMMServer "vmmserver" | where {$_.Status -eq "VALUE"}
For example, the command below queries a VMM server for information related to virtual machines in a running state and redirects the responses into a text file called Running.txt:
Get-VM -VMMServer "stevethvmm.contoso.local" | where {$_.Status -eq "Running"}>C:\VM-Queries\Running.txt
Image may be NSFW.
Clik here to view.
In the example below, here is a query for all virtual machines managed by a VMM server that currently have incomplete virtual machine configuration.
Get-VM -VMMServer "steveth-x64.northamerica.corp.microsoft.com" | where {$_.Status -eq "IncompleteVMConfig"}>C:\VM-Queries\IncompleteVM.txt
Steve Thomas | Senior Support Escalation Engineer
Image may be NSFW.
Clik here to view. Image may be NSFW.
Clik here to view.
Clik here to view.

Clik here to view.