PowerCLI

 View Only
  • 1.  Need to Get-vm Guest OS information

    Posted Sep 16, 2020 01:00 PM

    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

      



  • 2.  RE: Need to Get-vm Guest OS information
    Best Answer

    Posted Sep 16, 2020 01:14 PM

    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.



  • 3.  RE: Need to Get-vm Guest OS information

    Posted Sep 16, 2020 02:02 PM

    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.