Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to use psexec.exe to run batch scripts on Windows Server 2008. I cannot use plaintext passwords, so I'm using the "-s" flag, and not providing a username/password. I get the following error:

Logon failure: unknown user name or bad password.

The command I'm running is:

> "E:\Deploy\psexec" \\whichever-server.com  cmd /c net stop "MyService"

Now, this exact process works fine on our old Windows Server 2003 servers, but we're being forced to migrate. I've been reading up on psexec.exe documentation the past day and so far have seen nothing that could point to the cause of this issue appearing on Windows Server 2008--any assistance would be greatly appreciated.

share|improve this question

1 Answer 1

You do not need the -s flag if all you want it for is to prevent an authentication prompt. PSExec uses RPC to install a service at the remote computer and do a call to this service to execute the named command.

Specifying "-s" just means that the execution context for the specified command will be the built-in SYSTEM / LocalSystem account context. Not specifying this flag, the command will be run within the context of the calling user (or the user account specified with the -U parameter).

If you need to run a command remotely without specifying credentials, you have to make sure that a) the user you started "psexec" with is a valid account from the remote machine's perspective and b) it is authorized to install a service via RPC and run whatever you want to have run. The "unknown user name or bad password" error raises the suspicion that a) is not complied with. Check if the user running psexec can access the remote machine's shares as a quick test.

share|improve this answer
    
Hi, thanks for the reply. I was mainly using the "-s" option as that is what the script was originally doing. When I run the script on our Win2k8 servers without the "-s" option, the result is the same as with. My user account has full admin privs on the machine--I am running these scripts directly from on of the servers and still getting the error, which makes the "unknown username" error all the more confusing. If it matters, my account is a domain account, and not a local machine account however. –  DashRantic Feb 10 '12 at 0:55
    
@DashRantic does it work if you specify the username / password explicitly with the -u and -p options for testing purposes? –  the-wabbit Feb 10 '12 at 8:53
    
No, it doesn't appear to work that way either. –  DashRantic Feb 10 '12 at 21:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.