ShellCommandtextReturn(%systemroot%\sysnative\windowspowershell\v1.0\powershell.exe $PSVersionTable.PSVersion | Select-String -pattern 4,4.0)

I only want to create a rule for Powershell version 4. So the idea i had was to get the version number from the $PSVersionTable. This returns an actual table and I really only want one number. So I used the Select-string -pattern of 4. In the powershell window on a computer, it returns 4.0. So the comma 4.0 at the end of the statement is supposed to match the output on the command but doesn't.

Any ideas?
2 Comments   [ + ] Show Comments


  • Try ($PSVersionTable).PSVersion | Select -Expand Major
  • Or if you only want powershell 4

    ($PSVersionTable).PSVersion | Where-Object {$_.Major -eq '4'} | Select -Expand Major
Please log in to comment

There are no answers at this time


Answer this question or Comment on this question for clarity