Solved

PSEXEC not executing correctly through SQL

Posted on 2008-06-11
8
2,417 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

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
 

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

Are You Headed to Black Hat USA 2017?

Getting ready for Black Hat next week? Kick things off with the WatchGuard Badge Challenge and test your puzzle and cipher skills. Do you have what it takes to earn our limited edition Firebox Badge? Get started today - https://crimsonthorn.net

Question has a verified solution.

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

Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
OfficeMate Freezes on login or does not load after login credentials are input.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

635 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