The first one-liner will return all the Virtual Machines which are not upgraded to vSphere yet.
Get-View -ViewType VirtualMachine | Where-Object `
{-not $_.config.template -and $_.Config.Version -eq "vmx-04" } | Select Name
The second one-liner will return all the Virtual Machines which are not upgraded to vSphere and where the VMware Tools are not upgraded.
Get-View -ViewType VirtualMachine | Where-Object ` {-not $_.config.template -and $_.Config.Version -eq "vmx-04"` -and $_.Guest.ToolsVersion -lt "8193"} | Select Name
Update: If you want to count the Virtual Machines then you can run this one-liner:
(Get-View -ViewType VirtualMachine | Where-Object ` {-not $_.config.template -and $_.Config.Version -eq "vmx-04"` -and $_.Guest.ToolsVersion -lt "8193"} | Select Name).Count
These two one-liners are part of a much bigger script. So keep an eye on http://ict-freak.nl 😉
Embrase the one-liner 🙂 Welcome to the dark side !
Very nice, but I’ll take your one-liner and raise you a cmdlet 😀
Get-View -ViewType VirtualMachine `
-filter @{“Config.Template”=”false”;”Config.Version”=”vmx-04″} `
-property Config, Name
One-liners are fun, but performance can take a big hit if you lean too heavily on where. Side note you can also count by piping your output into measure-object. I prefer this method b/c it doesn’t require the () .
Get-View -ViewType VirtualMachine | Measure