Solved

Psexec Commands

Posted on 2011-09-21
10
782 Views
Last Modified: 2012-05-12
When I am trying to execute a batch file using the following Psexec command:
psexec @computers.txt c:\localbatchfile.cmd

I am getting Access denied though I am using my admin account. Any help is appreciated. Thanks
0
Comment
Question by:jmohan0302
[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
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 47

Expert Comment

by:Donald Stewart
ID: 36576464
Does your admin account have admin access on the remote computers?

Does the remote computers have "c:\localbatchfile.cmd" located locally on them ?
0
 
LVL 7

Expert Comment

by:ednetman
ID: 36578170
what OS is on the computer you are on and the target machine? could it be a UAC issue?
0
 

Accepted Solution

by:
jmohan0302 earned 0 total points
ID: 36582320
Both are 2003 machines. I have admin access on both the servers. The c;\localbatchfile.cmd is from the C$ share of the source machine from where I am executing the psexec command. I have admin access on C$ shares.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 15

Expert Comment

by:Russell_Venable
ID: 36582519
It should look like this:

Psexec @computers.txt -u <user> -p <pass> \\c$\Localbatchfile.cmd

Using UNC path and user credentials to execute the batch file remotely assuming you have remote administration enabled through the registry.
0
 
LVL 47

Expert Comment

by:Donald Stewart
ID: 36582534
"The c;\localbatchfile.cmd is from the C$ share of the source machine from where I am executing the psexec command. I have admin access on C$ shares."

Then you need to use the copy switch, try the following




psexec @computers.txt -c -f -s c:\localbatchfile.cmd


0
 
LVL 47

Expert Comment

by:Donald Stewart
ID: 36582590
If the file/path does not exist on the remote, then psexec will fail. You must use the copy switch(-c)

-f=force(In case the file has previously been copied over)
-s=System(run in the System User context) <<<You will have more success using the "-s" switch
-d=dont wait till moving on to next pc <<< I like to use this switch when using the @computers.txt
0
 

Author Comment

by:jmohan0302
ID: 36932924
Still I am getting access denied. Kindly let me know what are the pre-requisite for using Psexec commands. Thanks
0
 
LVL 7

Expert Comment

by:ednetman
ID: 36933221
Access denied at what point?  Is it while psexec is trying to connect? Or is it when the batch file starts?

Try this, we can test your permissions by simply running this command.

psexec \\SERVERNAME cmd

SERVERNAME is to be replaced with the name of your target server.

This will simply launch a remote command prompt. From here you van verify connection by running HOSTNAME, IPCONFIG, GETMAC, etc.

If you get access denied with this command, then it is permissions based. If it works, then we can take the next step in troubleshooting this problem.
0
 

Author Comment

by:jmohan0302
ID: 37014540
Hi Ednetman,

Its working fine. Please let me know how to execute a sample script for a list of servers using Psexec. Thanks
0
 

Author Closing Comment

by:jmohan0302
ID: 37822748
Resolved
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
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…

689 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