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 1 | Header 2 | Header 3 | Header 4 | Header 5 | Header 6 |
---|---|---|---|---|---|
Name | Configured OS" | Running OS | CPU | mEMORY | total 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
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
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
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.