TROUBLESHOOTING: Test PowerShell - Windows
Log In or Register to download the BES file, and more.

0 Votes

Versioning - This is the latest version.

1TROUBLESHOOTING: Test PowerShell - Windows4/8/2015 1:34:26 PM
2TROUBLESHOOTING: Test PowerShell - Windows4/8/2015 1:43:30 PM

Description

This task will test the execution of a powershell command through BigFix on the target system. The powershell version will be reported as the exit code of the action.

See a related analysis here:  http://bigfix.me/analysis/details/2994540

 


Property Details

ID5020
StatusBeta - Preliminary testing ready for more
TitleTROUBLESHOOTING: Test PowerShell - Windows
DomainBESC
SourceInternal
Source Release Date4/8/2015 12:00:00 AM
Added by on 4/8/2015 1:43:30 PM
Last Modified by on 4/8/2015 1:43:30 PM
Counters 2545 Views / 23 Downloads
User Rating 1 star 2 star 3 star 4 star 5 star * Average over 0 ratings. ** Log In or Register to add your rating.

Relevance

isWindows (Relevance 1172)
Used in 1070 fixlets and 522 analyses   * Results in a true/false
Show indented relevance
windows of operating system

Actions

Action 1 (default)

Action Link Click here to deploy this action.
Script Type BigFix Action Script
delete C:\windows\temp\bigfix_test_powershell.txt

waithidden powershell -ExecutionPolicy Bypass -command "Get-Host | out-file C:\windows\temp\bigfix_test_powershell.txt"

continue if{ exists (it) whose(it as lowercase starts with "name") of (concatenation of characters whose (it != "%00") of it) whose(it as trimmed string != "") of lines of files "C:\windows\temp\bigfix_test_powershell.txt" }

// The exit code is the major version of powershell or -1 if it cannot find the version #
exit { (unique value of (it as integer) of preceding texts of firsts "." of (it as string) of pads of (it as trimmed string as version) of following texts of firsts ":" of (it) whose(it as lowercase starts with "version") of (concatenation of characters whose (it != "%00") of it) whose(it as trimmed string != "") of lines of files "C:\windows\temp\bigfix_test_powershell.txt") | -1 }
Success Criteria

This action will be considered successful when the applicability relevance evaluates to false.


Sharing

Social Media:
Share this page on Yammer

Comments

Log In or Register to leave comments!
jgstew -
$psversiontable.psversion might be the better option anyway actually https://forum.bigfix.com/t/january-intel-meltdown-patches/24077/29
kjmccann1 -
To return the version directly as an exit code and without needing to write and read a text files: waithidden powershell -ExecutionPolicy Bypass -command "exit $psversiontable.psversion.Major.ToString()" parameter "psversion"="{if exist exit code of action then exit code of action as string else "-1"}" exit {parameter "psversion"}