KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Running a Powershell Script via RMA

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
johnm



Joined: 01 Apr 2005
Posts: 117

PostPosted: Fri Feb 01, 2013 5:32 pm    Post subject: Running a Powershell Script via RMA Reply with quote

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
View user's profile Send private message
johnm



Joined: 01 Apr 2005
Posts: 117

PostPosted: Fri Feb 01, 2013 5:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
johnm



Joined: 01 Apr 2005
Posts: 117

PostPosted: Fri Feb 01, 2013 5:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
johnm



Joined: 01 Apr 2005
Posts: 117

PostPosted: Fri Feb 01, 2013 5:39 pm    Post subject: Reply with quote

last thing I can think of... the RMA is x64 and the HM is x86.
Back to top
View user's profile Send private message
johnm



Joined: 01 Apr 2005
Posts: 117

PostPosted: Fri Feb 01, 2013 5:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Fri Feb 01, 2013 6:00 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index