I want to learn the powershell version and write conditions accordingly, but I couldn't do it as I wanted.
"(Get-Host).Version | Select-Object major"
Output:
Major
-----
5
When I use the command, I guess it doesn't work because it shows as value under major. How can I get the value?
I tried something like this so I can get it as True or False, but it didn't work. It always returns false
if ( "(Get-Host).Version | Select-Object major" -eq "5" )
{
echo "True"
}
else
{
echo "False"
}
Output:
false