SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Cannot execute powershell script
Goto page Previous  1, 2
 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Cannot execute powershell script
Author Message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6502

Post Reply with quote
Are you entering the path in the startin directory enclosed in double quotes by any chance?
Mon Mar 18, 2013 10:02 pm View user's profile Send private message
kishorepi



Joined: 11 Mar 2013
Posts: 10
Country: United States

Post Reply with quote
No, i just copy and pasted the path as is no quotes.

Am i missing antyhing?
Tue Mar 19, 2013 8:18 am View user's profile Send private message
kishorepi



Joined: 11 Mar 2013
Posts: 10
Country: United States

Post Reply with quote
Can you please provide the steps to create a job to execute a batch file which internall executes a power shell script (.ps1) file?
Thu Mar 21, 2013 5:01 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6502

Post Reply with quote
The simplest method
1. In 24x7 create a new job. In the Job Wizard choose Script type job, click Next
2. For the script type choose, Batch/shell script
3. Paste the command line you want to use for your Powershell script and any other commands that might be required for running the script, for example
Code:
C:
CD C:\Windows\system32\WindowsPowerShell\v1.0
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe "E:\Program Files\t\DataDel.ps1"


3. Click Finish.
4. Run the job using Run Now -> Normal mode. If it works, finish job properties, schedule, error handling and notifications, etc... If it doesn't, review the job output (see the Output tab, click the output link).
If there are errors and you are not sure what to do about them, please post the complete output here
Fri Mar 22, 2013 7:42 am View user's profile Send private message
RLINick



Joined: 13 Aug 2013
Posts: 5

Post Reply with quote
I am running into the same issue of being unable to execute powershell scripts from 24x7.

I eliminated some issues I was having with the jobs hanging by following this thread:
http://www.softtreetech.com/support/phpBB2/viewtopic.php?t=21966&postdays=0&postorder=asc&highlight=powershell&start=0

I'm running this on server 2008 R2 - 64 bit.

I have the powershell portion being launched in a batch script that also writes to a text file during the start of the script and at the end of the script so I know the batch portion is executing to completion.
Nothing is logged in the job output. It tells me the file content is empty after the job completes:

File: C:\24x7\Output\299\299_20130813145032.out
Time: 13-Aug-2013 02:50:32 PM
Size: 0 bytes
=====================================================
[File content is empty]
Tue Aug 13, 2013 6:09 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6502

Post Reply with quote
24x7 captures standard output and standard error streams of the launched process. If you process launches a child process and that child process doesn't write to the same standard output and standard error, you are not going to see them in 24x7.

I suggest adding to your batch file before and after the powerashell command some output like

echo Before powershell script
.... command here
echo After powershell script


Check if that appears in the job output. If that doesn't help, disable "capture job output" property and try one more time.
Tue Aug 13, 2013 8:14 pm View user's profile Send private message
RLINick



Joined: 13 Aug 2013
Posts: 5

Post Reply with quote
Finally got some output and the issue I was having was with setting the execution policy for the x86 version of powershell.

http://social.technet.microsoft.com/Forums/windowsserver/en-US/964636ad-347e-4b23-8f7a-f36a558115dd/error-file-cannot-be-loaded-because-the-execution-of-scripts-is-disabled-on-this-system

I believe this resolved my problem.
Wed Aug 14, 2013 1:47 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6502

Post Reply with quote
Thank you for your feedback. I'm sure this info will be very helpful to other people who might be experiencing the same issue.
Thu Aug 15, 2013 8:22 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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
Design by Freestyle XL / Flowers Online.