Highlighted
Enthusiast
Enthusiast

Script for getting hardware version

Jump to solution

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.

0 Kudos
1 Solution

Accepted Solutions
Highlighted
User Moderator
User Moderator

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

0 Kudos
3 Replies
Highlighted
User Moderator
User Moderator

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

0 Kudos
Highlighted
User Moderator
User Moderator

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
0 Kudos
Highlighted
Immortal
Immortal

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

0 Kudos