Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I tried to execute notepad from cmd using the following command-

runas /noprofile /user:<username>@<ip> notepad

Then I got this output where I was asked to enter my password

Enter the password for <username>@<ip>:

After entering my password (which is correct), I got this output-

Attempting to start notepad as user "<username>@<ip>" ...
RUNAS ERROR: Unable to run - notepad
1326: Logon failure: unknown user name or bad password.

Any idea why I got the above output? I'm actually a dummy when it comes to programming and scripting in windows terminals. Also, is it possible for me to avoid the interaction part where I'm asked for password and enter it as part of the runas command itself?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

The "user" parameter expects user credentials that consist of a user name and an (optional) domain name, you can't use an IP address as you are attempting.

From runas /?:

<UserName> should be in form USER@DOMAIN or DOMAIN\USER

If you have no domain, you can use the target computer's name so that it knows to look there for the credential store to check against.

As to including the password so you don't have to type it, no you can't do that, as it is considered insecure.

Perhaps check out these SU questions related to dealing with that:

share|improve this answer
add comment

As I am not allowed to comment yet... Is this an Active Directory environment , or do you try to access a User or Group from an other computer.

If it's an AD environment i suggest NOT to use an IP but the domain name (NetBios name is also OK)

I just tried this out on my own an it worked out. (result is german)

 C:\Users\user>runas /noprofile /user:testuser@foobar.com notepad
Geben Sie das Kennwort für "testuser@foobar.com" ein:
Es wird versucht, notepad als Benutzer "testuser@foobar.com" zu starten...

C:\Users\user>runas /noprofile /user:foo_bar\testuser notepad
Geben Sie das Kennwort für "foo_bar\testuser" ein:
Es wird versucht, notepad als Benutzer "foo_bar\testuser" zu starten...

C:\Users\user>runas /noprofile /user:foobar.com\testuser notepad
Geben Sie das Kennwort für "foobar.com\testuser" ein:
Es wird versucht, notepad als Benutzer "foobar.com\testuser" zu starten...
share|improve this answer
add comment

If you want to specify username and password on command-line you can try PsExec from Syinternals/Microsoft.

share|improve this answer
add comment

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.