Running PS v2, and have a very simple query that isn’t returinng what I expect.
(Get-WmiObject -class Win32_OperatingSystem).Caption
If ((Get-WmiObject -class Win32_OperatingSystem).Caption -eq 'Microsoft Windows 7 Enterprise') {
Write-Host "Equals"
} Else {
write-host "not equals"
}
It returns this -
Microsoft Windows 7 Enterprise
not equals
The WMI Caption info is as expected. however when passed throguh the compare in my IF, its not returning what I expect(returns ‘not equal’ rather than ‘equal’).
No doubt something simple, but I just can’t see it.
Thanks