Trying to run psexec - job hangs
Hi all, Wonder if anyone can shed any light. I have a script task that kicks off psexec to run a command line app on our App server. I can run the package in BIDs, all works fine. Load the package up to SQL server ,run it through SSMS and it works fine But run the package from a SQL Job and it just hangs. Some more details: The account that SQL Server Agent logs in as has full rights to all relevent servers/folders I have custom logging enabled and it shows all tasks before my script working, then it hits the script and just hangs In 'Job Activity Monitor' the job is running Its as though it is waiting for input.. And it is there where I think the problem lies. I am calling the psexec via a C# process call. The code that starts the process: Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.StartInfo.CreateNoWindow = false; p.StartInfo.FileName = psexecPath; p.StartInfo.Arguments = _arguements; p.Start(); p.WaitForExit(); Dts.TaskResult = (int)ScriptResults.Success; p.Close(); When I run this locally I get 3 cmd type windows but they all disappear as soon as the command completes (the job loops thru 3 files) I am thinking that if I could logon to the server that the job is running on with the account that SQL Agent runs under I would see a black window with an error msg or a 'hit enter to continue...' :-) Can anyone see anything obvious Many thanks
November 27th, 2012 5:42pm

... When I run this locally I get 3 cmd type windows but they all disappear as soon as the command completes (the job loops thru 3 files) I am thinking that if I could logon to the server that the job is running on with the account that SQL Agent runs under I would see a black window with an error msg or a 'hit enter to continue...' :-) Hi LuckyJim1001, I think you are answering your own question, of course there is an error message waiting to be acknowledged could be very well a black window. If your DBA cannot let you in or provide a screenshot lets shoot in the dark: it is the account. Make a new domain based account for this SSIS step in the Agent job and assign it the proper rights, then change the step to run the package using this proxy, in case you need a hand making all as per specs see http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
November 27th, 2012 9:28pm

Thanks ArthurZ - I had emailed the DBA this morning and we just run the psexec I cannot believe what it was, and I should have thought of this as it happened the first time I run psexec on my machine. It was the PSTOOLS nag screen that comes up the first time psexec is run under a new user !!! As this is a new test machine no one had had to use psexec until me. Cleared that and the job ran fine straight away. Marked you reply as answer though as it still had some very useful info on Proxies, of which my knowledge is sadly lacking. Or was :-) Many thanks.
November 28th, 2012 5:12am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics