View previous topic :: View next topic |
Author |
Message |
johnm
Joined: 01 Apr 2005 Posts: 117
|
Posted: Fri Feb 01, 2013 5:32 pm Post subject: Running a Powershell Script via RMA |
|
|
Just getting started with Powershell scripts in HM.
Running v9.38 and RMA v4.54
Trying to run a simple Powershell script.
powershell.exe -file c:\tools\getec2status.ps1 i-356a3b44
where i-356a3b44 is a parameter I'm passing.
The script exits and sets the DOS %errorlevel% to a numeric.
I run this from a DOS prompt on HM server and on RMA, and it works.
I can run it in HM as a local test, (I see the DOS window open and close) and the %errorlevel% is shown as the reply.
Running via an RMA agent it fails to bring back the %errorlevel%, only a 0. I am almost certain the DOS window is not opening on the RMA because I don't see it show up in task manager on the RMA.
These are 2 brand newly built Windows 2008 servers. The HM server is plain Windows 2008, the RMA is R2.
Advice? |
|
Back to top |
|
|
johnm
Joined: 01 Apr 2005 Posts: 117
|
Posted: Fri Feb 01, 2013 5:36 pm Post subject: |
|
|
I am running both RMA and HM as an application at the moment but will eventually want to run both as a service. |
|
Back to top |
|
|
johnm
Joined: 01 Apr 2005 Posts: 117
|
Posted: Fri Feb 01, 2013 5:38 pm Post subject: |
|
|
I have performed this change as per another KB here on ks-soft.com
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope LocalMachine
No luck. |
|
Back to top |
|
|
johnm
Joined: 01 Apr 2005 Posts: 117
|
Posted: Fri Feb 01, 2013 5:39 pm Post subject: |
|
|
last thing I can think of... the RMA is x64 and the HM is x86. |
|
Back to top |
|
|
johnm
Joined: 01 Apr 2005 Posts: 117
|
Posted: Fri Feb 01, 2013 5:42 pm Post subject: |
|
|
ok I feel kinda silly now for posting so many replies and finally figured it out.
I failed to run the following command in the 32bit version of powershell.
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope LocalMachine
this fixed it.
Can the 64bit version be forced on an RMA if it's a 64bit OS?
Just curious. |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Fri Feb 01, 2013 6:00 pm Post subject: |
|
|
Quote: | Can the 64bit version be forced on an RMA if it's a 64bit OS? |
Sure, just specify full path for x64 powershell (e.g. c:\Windows\Sysnative\windowspowershell\v1.0\powershell.exe) |
|
Back to top |
|
|
|