Was recently asked on twitter how to compare properties of an object in the version format (ie 1.2.3.4 >= 3.2.1.1). Well, as the property was string, which came into my mind was to remove the point. Something like
(Get-WmiObject win32_pnpsigneddriver |
Where-Object {(($_.DriverVersion).replace(‘.’,”)) -ge ‘3211’}).DriverVersion
Well, this solution will fail in some cases , as if you have NULL or other chars in the property. So, doing a better research, I found a post from Shay Levy (Actually he helped someone else)
https://www.cupfighter.net/2009/06/powershell-comparing-version-numbers
You can use the [version] type in Powershell to perform the operation (as showing in the post above)
(Get-WmiObject win32_pnpsigneddriver |
Where-Object {[version]$_.DriverVersion -ge [version]’1.0.20′}).DriverVersion
Awesome !!!