/build/static/layout/Breadcrumb_cap_w.png

CIR Populating Powershell Execution Policy Incorrectly

I have two CIRs for Powershell's Script Execution Policies as these will behave differently when set in the shell:

ShellCommandtextReturn(%systemroot%\syswow64\windowspowershell\v1.0\powershell.exe "get-executionpolicy")

&

ShellCommandtextReturn(%systemroot%\system32\windowspowershell\v1.0\powershell.exe "get-executionpolicy")

This returns "restricted" for the first and "unrestricted" for the second when I run the command locally as expected. When I use psexec to run under the system context it behaves exactly the same.  

The CIR returns "unrestricted" for both.  

The log has both commands listed correctly with the "Unrestricted" values for both:

[Mon May 20 13:20:02 2013] [CDeployController::ExecuteCustomInventoryRule] issuing rule [ShellCommandtextReturn(%systemroot%\syswow64\windowspowershell\v1.0\powershell.exe "get-executionpolicy");]

[Mon May 20 13:20:04 2013] [CDeployController::ExecuteCustomInventoryRule] issuing rule [ShellCommandtextReturn(%systemroot%\system32\windowspowershell\v1.0\powershell.exe "get-executionpolicy");]

Any thoughts on why the CIR is behaving differently than running the command directly?

Thanks.


1 Comment   [ + ] Show comment
  • Modified the code from "get-executionpolicy" to "[Environment]::Is64BitProcess". Both locations returned false. When run manually the system32 command returns true. Is it possible the KACE agent will not run powershell x64? - dimitris 11 years ago

Answers (1)

Answer Summary:
Posted by: flip1001 11 years ago
Black Belt
0

Try sysnative for 32-bit cmd accessing 64-bit exe

%systemroot%\sysnative\windowspowershell\v1.0\powershell.exe "get-executionpolicy"


Comments:
  • That did the trick. - dimitris 11 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ