VMware Cloud Community
cjabates
Contributor
Contributor
Jump to solution

script for VM info (BIOS/UEFI along with OS & HW version)

We are getting ready for setting up Windows 2016 Credential Guard, and due to requirements we need certain information about the VMs.

I'd like a single file that has the following:

VM name

Configured OS

Running OS

Hardware version

BIOS/UEFI

The below snippet gives me everything except for the BIOS/UEFI info in a single .csv file.  The BIOS/UEFI entry is supposed to be ExtensionData.Config.Firmware, but I don't know how to get that along with the rest.

Get-VM | Sort |

   Get-View -Property @("Name", "Config.GuestFullName", "Guest.GuestFullName", "Config.Version") |

   Select -Property Name,

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

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

       @{N="HW Version";E={$_.Config.Version}} |

   Export-CSV -notypeinfo -Path "c:\installs\vm_os_hw.csv"

Any assistance will be appreciated.

Thank you.

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

No problem, try like this

Get-View -ViewType VirtualMachine |

Select Name,

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

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

    @{N="HW Version";E={$_.Config.Version}},

    @{N='Firmware';E={$_.Config.Firmware}},

    @{N='ESXi Version';E={(Get-View -Id $_.Runtime.Host).Config.Product.FullName}} |

Sort-Object -Property Name |

Export-CSV -NoTypeInformation -Path "c:\installs\vm_os_hw.csv" -UseCulture


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

View solution in original post

5 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this.

The Firmware will contain 'bios' or 'efi'.

Get-View -ViewType VirtualMachine |

Select Name,

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

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

    @{N="HW Version";E={$_.Config.Version}},

    @{N='Firmware';E={$_.Config.Firmware}} |

Sort-Object -Property Name |

Export-CSV -NoTypeInformation -Path "c:\installs\vm_os_hw.csv" -UseCulture


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

0 Kudos
cjabates
Contributor
Contributor
Jump to solution

Luc,

That worked great, but now they want the host ESXi version number as well.

Don't you just love when customers move the goalposts?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

No problem, try like this

Get-View -ViewType VirtualMachine |

Select Name,

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

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

    @{N="HW Version";E={$_.Config.Version}},

    @{N='Firmware';E={$_.Config.Firmware}},

    @{N='ESXi Version';E={(Get-View -Id $_.Runtime.Host).Config.Product.FullName}} |

Sort-Object -Property Name |

Export-CSV -NoTypeInformation -Path "c:\installs\vm_os_hw.csv" -UseCulture


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

cjabates
Contributor
Contributor
Jump to solution

Thanks again, Luc.

I added in a line to give the host's name as well, since I saw that I have different builds on different hosts.

Now it looks like this:

Get-VM | Sort |

   Get-View |

  Select Name,

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

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

   @{N="HW Version";E={$_.Config.Version}},

   @{N="Firmware";E={$_.Config.Firmware}},

   @{N="Host Name";E={(Get-View -Id $_.Runtime.Host).Name}},

   @{N="Host Version";E={(Get-View -Id $_.Runtime.Host).Config.Product.FullName}} |

   Sort-Object -Property Name |

   Export-CSV -notypeinfo -Path "c:\installs\vm_os_hw.csv"

0 Kudos
Alex_Romeo
Leadership
Leadership
Jump to solution

Hi LucD

you are a great!

ARomeo

 

 

Blog: https://www.aleadmin.it/
0 Kudos