ranjithbabhu
Enthusiast
Enthusiast

Need to Get-vm Guest OS information

Jump to solution

Need only non windows VMs information, in below scrip i am able to get the VM name and OS information. but in same script i need to get CPU, Memory and Total disksize of the VM. Can  anyone help it out.

 

Header 1Header 2Header 3Header 4Header 5Header 6
NameConfigured OS"Running OSCPUmEMORYtotal Disk SIZE

Get-VM |

where{$_.PowerState -eq 'PoweredOn' -and $_.Guest.OSFullName -Notmatch 'Windows'} |

Select Name,

    @{N="Configured OS";E={$_.ExtensionData.Config.GuestFullname}},

    @{N="Running OS";E={$_.Guest.OsFullName}},

    @{N="Powered On";E={ $_.PowerState -eq “PoweredOn”}} |

Export-Csv redhatVM-allVC.csv -NoTypeInformation -UseCulture

  

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

If you look at the VirtualMachine object returned by Get-VM, you'll notice that this object has the properties NumCPU, MemoryGB, UsedSpaceGB and ProvisionedSpaceGB.

You can just add those on your Select.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership

If you look at the VirtualMachine object returned by Get-VM, you'll notice that this object has the properties NumCPU, MemoryGB, UsedSpaceGB and ProvisionedSpaceGB.

You can just add those on your Select.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ranjithbabhu
Enthusiast
Enthusiast

Hi LucD,

Great and thanks. It work perfect.

Get-vm |

where{$_.PowerState -eq 'PoweredOn' -and $_.Guest.OSFullName -match 'WIN'} |

select Name,MemoryGB,NumCpu,UsedSpaceGB,

          

    @{N="Configured OS";E={$_.ExtensionData.Config.GuestFullname}},

    @{N="Running OS";E={$_.Guest.OsFullName}},

    @{N="Powered On";E={ $_.PowerState -eq “PoweredOn”}} |

Export-Csv redhatVM-allVC.csv -NoTypeInformation -UseCulture

Again thanks for the link.

0 Kudos