?
Solved

Psexec Commands

Posted on 2011-09-21
10
Medium Priority
?
786 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
Limited time offer using promo code EXPERTS30

Designed with a wealth of functionality and convenience, ATEN's new Thunderbolt™ 2 Sharing Switch takes your Thunderbolt setup to the next level. Now through September 15, 2017, Experts Exchange members get 30% off the US7220 on the ATEN USA eShop using promo code EXPERTS30.

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

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!
Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses

777 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