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.
No problem, try like this
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
Try like this.
The Firmware will contain 'bios' or 'efi'.
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
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?
No problem, try like this
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
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"
Hi LucD
you are a great!
ARomeo