4

When I run the following in ruby:

`powershell.exe -executionpolicy unrestricted -command get-module -listavailable`

...the result I get is different from if I just run cmd and execute:

powershell.exe -executionpolicy unrestricted -command get-module -listavailable

How can I fix this, so I can yield the same result?

3
  • I suspect that they are running in different user contexts and thus would potentially be loading different modules. Commented Oct 24, 2012 at 17:36
  • so apparently it is enumerating C:\windows\syswow64\windowspowershell\v1.0\modules Commented Oct 24, 2012 at 17:58
  • It should be enumerating modules under your user profile (typically under C:\Users\USERNAME\Documents\WindowsPowerShell) as well. Commented Oct 24, 2012 at 18:05

1 Answer 1

2

Yes. The fix apparently is the sysnative alias. Use:

C:/windows/sysnative/windowspowshell/v1.0/powershell.exe

Instead of syswow64 or system32 or none.

For more info see: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384187(v=vs.85).aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.