  | 
			
				SoftTree Technologies 
				Technical Support Forums
			 | 
		 
		  | 
	 
	 
	
	
	
		
	
	
	
		| Author | 
		Message | 
	 
	
		
			SysOp 
			Site Admin 
			
  
			
			
				Joined: 26 Nov 2006 Posts: 7992
  | 
			 
			  
		 | 
		
			
				   | 
				     | 
			 
			
				Are you entering the path in the startin directory enclosed in double quotes by any chance?
  | 
			 
		  | 
	 
	
		| Mon Mar 18, 2013 10:02 pm | 
		          | 
	 
	
		  | 
	 
	
		
			kishorepi 
			 
			
  
			
			
				Joined: 11 Mar 2013 Posts: 10 Country: United States | 
			 
			  
		 | 
		
			
				   | 
				     | 
			 
			
				No, i just copy and pasted the path as is no quotes.
 
 
Am i missing antyhing?
  | 
			 
		  | 
	 
	
		| Tue Mar 19, 2013 8:18 am | 
		          | 
	 
	
		  | 
	 
	
		
			kishorepi 
			 
			
  
			
			
				Joined: 11 Mar 2013 Posts: 10 Country: United States | 
			 
			  
		 | 
		
			
				   | 
				     | 
			 
			
				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 | 
		          | 
	 
	
		  | 
	 
	
		
			SysOp 
			Site Admin 
			
  
			
			
				Joined: 26 Nov 2006 Posts: 7992
  | 
			 
			  
		 | 
		
			
				   | 
				     | 
			 
			
				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
 
	  | 
	
 
	  | 
	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 | 
		          | 
	 
	
		  | 
	 
	
		
			RLINick 
			 
			
  
			
			
				Joined: 13 Aug 2013 Posts: 5
  | 
			 
			  
		 | 
		
			
				   | 
				     | 
			 
			
				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 | 
		          | 
	 
	
		  | 
	 
	
		
			SysOp 
			Site Admin 
			
  
			
			
				Joined: 26 Nov 2006 Posts: 7992
  | 
			 
			  
		 | 
		
			
				   | 
				     | 
			 
			
				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 | 
		          | 
	 
	
		  | 
	 
	
		
			RLINick 
			 
			
  
			
			
				Joined: 13 Aug 2013 Posts: 5
  | 
			 
			  
		 | 
		 | 
	 
	
		| Wed Aug 14, 2013 1:47 pm | 
		          | 
	 
	
		  | 
	 
	
		
			SysOp 
			Site Admin 
			
  
			
			
				Joined: 26 Nov 2006 Posts: 7992
  | 
			 
			  
		 | 
		
			
				   | 
				     | 
			 
			
				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 | 
		          | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
	 
	    
	   | 
	
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
  | 
   
 
		 | 
	 
	  |