Script Snip: “I am trying to find out how I can get the number of processors for a non-active VM”


From the Hyper-V Technet forums a question came about on how to get the number of processors for a non-active VM. You can see the varying answers here.

Thinking of the PowerShell options available with Hyper-V and SCVMM this is what came to mind for me using the Get-VMSummary and state attributes like EnabledState and Status.


With the Hyper-V PowerShell cmdlets installed (more info here you can use the following:

Get-VMSummary -server HOST1, HOST2, HOST3 | ? {$_.EnabledState -eq "Stopped"} | ft VMElementName, CPUCount, EnabledState

If you want to export it to a CSV you can do the following

Get-VMSummary -server HOST1, HOST2, HOST3 | ? {$_.EnabledState -eq "Stopped"} | Select-Object VMElementName, CPUCount, EnabledState | Export-CSV "C:\info.csv" -notypeinformation

From the SCVMM PowerShell command console you could do the following:

Get-VM | ? {$_.status -eq "PowerOff"} | ft name, cpucount, status -a

If you want to export to CSV from SCVMM prompt

Get-VM | ? {$_.status -eq "PowerOff"} | select-object name, cpucount, status | export-csv "c:\info.csv" –notypeinformation


This entry was posted in Hyper-V, SCVMM. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s