Solved

Psexec Commands

Posted on 2011-09-21
10
779 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
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 
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

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
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…

749 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