Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2461
  • Last Modified:

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_tst.cmd'

Open in new window

0
gnchq
Asked:
gnchq
1 Solution
 
Compaq_EngineerCommented:
Does the user that the MS SQL process runs as have permissions to the other server?
0
 
gnchqAuthor Commented:
Yes.  We are using a domain account that has local admin rights on both the executing and receiving servers.
0
 
sirbountyCommented:
Try passing it through the command interpreter...
master..xp_cmdshell 'cmd /c d:\pstools\psexec \\servername -u username -p password -d d:\dbascripts\2_Stoplawson_tst.cmd'

Open in new window

0
New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

 
gnchqAuthor Commented:
Thanks for helping us out.  I thought it had to by syntax since there are so few issues posted on this subject.
0
 
gnchqAuthor Commented:
Awesome.....thanks sirbounty....that was it!  Adding "cmd /c" resolved the issue.
0
 
sirbountyCommented:
Glad to help.
Thanx for the notification - and the grade. :^)
0
 
dijjitCommented:
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!
0
 
sirbountyCommented:
You should open a new question.  It's against site policies to piggy back on a closed question...
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now