• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 844
  • 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
 
DonNetwork 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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
 
DonNetwork 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
 
DonNetwork 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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