2 Replies Latest reply on Sep 16, 2020 7:02 AM by ranjithbabhu

    Need to Get-vm Guest OS information

    ranjithbabhu Novice

      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

        

        • 1. Re: Need to Get-vm Guest OS information
          LucD Guru
          Community WarriorsvExpertUser Moderators

          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: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 2. Re: Need to Get-vm Guest OS information
            ranjithbabhu Novice

            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.