user3049523
user3049523

Reputation: 65

Psexec does not work with UAC enabled

I have a Server 2008 R2 Standard. I need to execute a batch-file using psexec from my PC Win7. The only time this worked is when i disabled the UAC on my server. Deactivating the UAC is out of the question, I'm looking for a solution with UAC enabled.

Error message: Could not start PSEXESVC service on remotehost: Access denied.

PS: In my command line of psexec I'm using the administrator user of my server to execute the batch-file. The UAC level is 3 on my server.

Best regards, Tasso

Upvotes: 1

Views: 9600

Answers (2)

Paul Feld
Paul Feld

Reputation: 271

It took me hours to find a working way to PsExec between two Windows 7 computers with a non-Admin user starting PsExec.

Disabling UAC...

EnableLUA=0
ConsentPromptBehaviorAdmin=0
LocalAccountTokenFilterPolicy=1

...did not work, turning off the firewall did not work.

Here I found the working way - thanks JelmerS (PSexec is not connecting to machine using supplied username and password).

*This is because psexec still tries to access the ADMIN$ share with your local credentials, before executing your command as another user. According to this thread, you can cache credentials before executing psexec:

cmdkey.exe /add:MACHINE_NAME_HERE /user:MACHINE_NAME_HERE\Administrator /pass:PASSWORD_HERE 
psexec.exe \\MACHINE_NAME_HERE -i notepad
cmdkey.exe /delete:MACHINE_NAME_HERE*

Best regards, Peter

Upvotes: 8

Sunny
Sunny

Reputation: 8292

It seems that running PsExec from a Win7/Win2K8 machine against a Win7/Win2K8 target, regardless of the "-u" and "-p" params on the PsExec command-line,those params are ignored and PsExec is being executed remotely with whatever user credentials we happen to be logged in locally with. Even though you stating which user account to execute the command on the remote system it executes the psexec command as the user that opened the command window.
When opening the Command Prompt, please right click it and select 'run as Administrator'. Meanwhile, make sure the user has administrator privileges on target PC.

The only solution i see to offer is to use the "Runas" (with the account you will need on the remote system) command to execute PsExec and forget the -u -p params.

In command prompt, you can try as,

echo "password" > pwd
runas /env /netonly /user:domain\Administrator "psexec.exe your_local_program.bat" < pwd
del pwd

Or just:

echo password | runas /env /netonly /user:domain\Administrator "psexec.exe your_local_program.bat"

Moreover....

Don't forget to check your Anti-virus which frequently blocks several of the PStools.

Upvotes: 1

Related Questions