This is perhaps going a bit out of bounds, so i'm not confident I'll get an answer. The short of this is that I've created a python script which leverages psexec to start a bat file on a remote server. This works superb until I publish it. Fortunately I do know where the scripts and models get uploaded to the GIS server after publishing which can help a great deal with diagnostics. Prior to the psexec line in the script, I'm copying a file from one location to another, and I can see that is successful because of the time stamp of the copied file. So, i'm fairly confident that the server is getting hung up on the psexec portion.

Here is what the published script looks like. enter image description here

The ArcGIS account does have read/execute access to the psexec.exe folder. When the GP service is run, it just hangs until it times out. So, since I need to define a question: has anyone used psexec in the arcgis server environment? This should be a lot easier than it is. Is there a way to see if the process is hanging on the remote end?

  • I dont know psexec. I can say that if the .exe you're calling requires any sort of input (like it pops a window, and you have to click ok), or it absolutely has to pop a window to be shown on the active display, it wont work. For example, this will fail as it waits for the cmd.exe to be dismissed os.system("cmd.exe") vs. this os.system("c:\test\test.bat") which runs to completetion (bat just does an echo) – KHibma May 1 '13 at 22:28
  • actually, my initial tests with psexec using os.system skip the command CMD altogether and just call the bat file. Is what you are describing a function of all executions, or just how AGS executes commands? – Clickinaway May 2 '13 at 1:14

The first place I would check are the logs in the event viewer on the remote server. I see you have 'SQL' in the path there. If you're connecting to a database, ensure the process owner (which I believe would be the ArcGIS Server admin account if you're running it as a GP tool in AGS) has access to the database if you use Active Directory authentication.

You can enable history logging on the remote server as described in this article. That might also give you some clues.

I hope that's a little bit of help. Good luck!

  • I will check the event viewer, thanks! this is where things get a bit confusing regarding permissions. PSEXEC actually allows you to send user/AD credentials within the CMD line. I may try that. The only reason I havn't is that all my tests from the command line work just dandy. – Clickinaway May 2 '13 at 1:18
  • I didn't mark this as the actual answer, but I did up-vote it. Using the logs in the event viewer was a big help in getting this thing solved. The thing to remember is that while all of my initials tests were CMD line or PY script, when the thing is actually published, everything executes under the ArcGIS account. That is key to diagnosing the execution of processes. – Clickinaway May 3 '13 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.