gnchq
asked on
PSEXEC not executing correctly through SQL
Trying to run the psexec command below through SQL cmdshell. The command is running from one server and executing on another. If we run the command from outside of SQL, it works. Running in SQL it gets as far as starting psexec (verified through Windows task manager) and just hangs.
master..xp_cmdshell 'd:\pstools\psexec \\servername -u username -p password -d d:\dbascripts\2_Stoplawson _tst.cmd'
master..xp_cmdshell 'd:\pstools\psexec \\servername -u username -p password -d d:\dbascripts\2_Stoplawson
master..xp_cmdshell 'd:\pstools\psexec \\servername -u username -p password -d d:\dbascripts\2_Stoplawson_tst.cmd'
Does the user that the MS SQL process runs as have permissions to the other server?
ASKER
Yes. We are using a domain account that has local admin rights on both the executing and receiving servers.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks for helping us out. I thought it had to by syntax since there are so few issues posted on this subject.
ASKER
Awesome.....thanks sirbounty....that was it! Adding "cmd /c" resolved the issue.
Glad to help.
Thanx for the notification - and the grade. :^)
Thanx for the notification - and the grade. :^)
So I have tried the above but my script still runs forever.
Curiously, if I ask it to run a process that is going to error (e.g. error code 1 or above) - it returns fine. However, if things are returning with error code 0 (e.g. sucess) - then they never return within SQL.
I have checked the user details and can confirm there is no issues there. Urgently need to get this working!! Help!
Curiously, if I ask it to run a process that is going to error (e.g. error code 1 or above) - it returns fine. However, if things are returning with error code 0 (e.g. sucess) - then they never return within SQL.
I have checked the user details and can confirm there is no issues there. Urgently need to get this working!! Help!
You should open a new question. It's against site policies to piggy back on a closed question...