How do you create a custom inventory rule for figuring out a machine's Powershell Version?
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
Answers (0)
Please log in to answer
Be the first to answer this question
($PSVersionTable).PSVersion | Where-Object {$_.Major -eq '4'} | Select -Expand Major - flip1001 9 years ago