Running a Powershell Script via RMA

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
johnm
Posts: 117
Joined: Fri Apr 01, 2005 9:49 pm

Running a Powershell Script via RMA

Post by johnm »

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?
johnm
Posts: 117
Joined: Fri Apr 01, 2005 9:49 pm

Post by johnm »

I am running both RMA and HM as an application at the moment but will eventually want to run both as a service.
johnm
Posts: 117
Joined: Fri Apr 01, 2005 9:49 pm

Post by johnm »

I have performed this change as per another KB here on ks-soft.com
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope LocalMachine

No luck.
johnm
Posts: 117
Joined: Fri Apr 01, 2005 9:49 pm

Post by johnm »

last thing I can think of... the RMA is x64 and the HM is x86.
johnm
Posts: 117
Joined: Fri Apr 01, 2005 9:49 pm

Post by johnm »

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.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

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)
Post Reply