Solved

PSEXEC not executing correctly through SQL

Posted on 2008-06-11
8
2,344 Views
Last Modified: 2013-12-04
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
Comment
Question by:gnchq
8 Comments
 
LVL 6

Expert Comment

by:Compaq_Engineer
ID: 21762633
Does the user that the MS SQL process runs as have permissions to the other server?
0
 

Author Comment

by:gnchq
ID: 21762653
Yes.  We are using a domain account that has local admin rights on both the executing and receiving servers.
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 21769716
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
 

Author Closing Comment

by:gnchq
ID: 31466263
Thanks for helping us out.  I thought it had to by syntax since there are so few issues posted on this subject.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:gnchq
ID: 21771575
Awesome.....thanks sirbounty....that was it!  Adding "cmd /c" resolved the issue.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 21771582
Glad to help.
Thanx for the notification - and the grade. :^)
0
 

Expert Comment

by:dijjit
ID: 23837562
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
 
LVL 67

Expert Comment

by:sirbounty
ID: 23856437
You should open a new question.  It's against site policies to piggy back on a closed question...
0

Featured Post

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SHARE your personal details only on a NEED to basis. Take CHARGE and SECURE your IDENTITY. How do I then PROTECT myself and stay in charge of my own Personal details (and) - MY own WAY...
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
A simple description of email encryption using a secure portal service. This is one of the choices offered by The Email Laundry for email encryption. The other choices are pdf encryption which creates an encrypted pdf of your email and any attachmen…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now