PSexec and windows 2008 server (access denied)

Viewed 15910

I have a program which uses psExec for retrieving environment variables on a remote host. I get the error: Could not start PSEXESVC service on xxhost Access denied.

This command works for windows 2003 servers but not 2008 (it works on 2008 if I run CMD as another user): psexec \xxhost -u xxdomain\xxuser -p xxpasswrd-h cmd /c echo %%JAVA_HOME^%%

I also tried creating a connection before executing psexec (with NET USE)-as above, this works on 2003 but not 2008: NET USE \XXhost psexec \host cmd /c echo %%JAVA_HOME^%%

The problem is that I can't use RUNAS in batchfiles as it prompts for password. So, does anybody know how a workaround without having to make changes on the remote server?

3 Answers

For me, even using PSEXEC64 didn't work. Still received the same error. Here's what did work - I had to add the user that was running the psexec command to the remote machine's administrators group and then sign out, then sign in as that user.

But then I was getting a new error: "Logon Failure: the user has not been granted the requested logon type at this computer"

The fix for this problem was to add the -i switch to the command line. This only applies to PSEXEC version 2.30 and higher. So my command prompt looked like this:

psexec64 -u domain\username -p password -i \\remotemachinename cmd
Related