• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 834
  • Last Modified:

Psexec Commands

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
jmohan0302
Asked:
jmohan0302
  • 4
  • 3
  • 2
  • +1
1 Solution
 
Donald StewartNetwork AdministratorCommented:
Does your admin account have admin access on the remote computers?

Does the remote computers have "c:\localbatchfile.cmd" located locally on them ?
0
 
ednetmanCommented:
what OS is on the computer you are on and the target machine? could it be a UAC issue?
0
 
jmohan0302Author Commented:
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Russell_VenableCommented:
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
 
Donald StewartNetwork AdministratorCommented:
"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
 
Donald StewartNetwork AdministratorCommented:
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
 
jmohan0302Author Commented:
Still I am getting access denied. Kindly let me know what are the pre-requisite for using Psexec commands. Thanks
0
 
ednetmanCommented:
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
 
jmohan0302Author Commented:
Hi Ednetman,

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

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now