1

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.

1 Answer 1

0

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.

3
  • 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, 2012 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, 2012 at 8:53
  • No, it doesn't appear to work that way either.
    – DashRantic
    Feb 10, 2012 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .