Check Powershell Verision with Relevance

(imported topic written by jlasher)

Hello,

I did try searching for this issue, but I couldn't find anything with an answer.  I would like to deploy PowerShell using a custom fixlet.  I have a relevance to check the version of the powershell.exe and it works without any issues in the fixlet debugger.  However when I enter the relevance in the custom fixlet, it doesn't show any relevant devices and I can't seem to figure out why.  The relevance I came up with is shown below. 

(if (version of it as string contains “6.1”) then “True” else “False”) of file (“C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”)

Can anyone tell me why this works fine in the debugger but not in the fixlet? The 6.1 changes with the version.

6.0 = Powershell v1.0

6.1 = Powershell v2.0

6.2 = Powershell v3.0

6.3 = Powershell v4.0

So in the relevance I am looking to find which computers have Powershell v2.0 installed.

Thank you,

(imported comment written by BrianPGreen)

If that’s exactly the relevance that you’re using, the problem is that the return type is “string” instead of “boolean” because True and False are in quotes. Try changing the relevance to:

(if (version of it as string contains “6.1”) then True else False) of file (“C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”)

Or even more simple:

(version of it as string contains “6.1”) of file “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”

(imported comment written by jlasher)

That works a lot better. Should have realized that, thank you.

(imported comment written by jgstew)

This is related:
http://bigfix.me/analysis/details/2994540

1 Like