Running runas cmd in Powershell

66,644

You could try

runas /user:administrator cmd

without the backslash before administrator. That works for me – when I replace administrator with a valid user name for an administrator on my computer, of course.

When it comes to the other command you tried:

runas /user:AdministratorAccountName@ ComputerName

it should read

runas /user:ComputerName\AdministratorAccountName

where ComputerName is a valid computer name and AdministratorAccountName is a valid name of a user account.

Share:
66,644

Related videos on Youtube

Raz
Author by

Raz

Updated on September 18, 2022

Comments

  • Raz
    Raz over 1 year

    I am a beginner and am trying to understand how to use the runas command in Windows Powershell.

    When I type the following command into Powershell:

    runas /user:<localmachinename>\administrator cmd
    

    I am asked to enter a password. When I do so, I am told that:

    1326: Logon failure: unknown user name or bad password.
    

    Also, when I type this command into Powershell:

    runas /user:AdministratorAccountName@ ComputerName
    

    I get:

    RUNAS ERROR: Unable to acquire user password
    

    I can't see the password when I type it in. But I have done it multiple times correctly and always get those messages.

    Would appreciate some help on this.

    Thanks!

    • Mathias R. Jessen
      Mathias R. Jessen over 9 years
      Have you tried runas /user:$($env:COMPUTERNAME)\Administrator cmd?
    • Jeeva
      Jeeva over 9 years
      or /user:.\Administrator. Scratch that - just tested it, Mathias' suggestion works, mine doesn't.