VMware Cloud Community
peter79
Enthusiast
Enthusiast
Jump to solution

Script for getting hardware version

Guys,

Does anyone have a PowerShell script that could get all VM's with a particular virtual hardware version (VM version 4 in this instance) and output it to a excel file (or any type file really)?

Thanks.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try this

Get-VM | where{$_.Extensiondata.Config.Version -eq "vmx-04"} | Select Name | Export-Csv "C:\VM-HW4.csv" -NoTypeInformation

____________

Blog: LucD notes

Twitter: lucd22


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

View solution in original post

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

Try this

Get-VM | where{$_.Extensiondata.Config.Version -eq "vmx-04"} | Select Name | Export-Csv "C:\VM-HW4.csv" -NoTypeInformation

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can use Alan Renouf's vCheck script from www.virtu-al.net. That script returns vm's with hardware version 4.

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

You can also use this script, since it's much faster than retrieving the ExtensionData property:

# You can specify either "v4" or "v7" for hardware version
Get-VM | where {$_.Version -eq "v4"} | select name


-


PowerCLI development team

Reply
0 Kudos