Runas: Difference between revisions

From RCATs
(Created page with "== Runas ==")
 
No edit summary
Line 1: Line 1:
== Runas ==
== Runas ==
Execute a program under a different user account (non-elevated).<syntaxhighlight lang="powershell">
Syntax:
      RUNAS [ [/noprofile | /profile] [/env] [/savecred | /netonly] ]
        /user:UserName program
      RUNAS [ [/noprofile | /profile] [/env] [/savecred] ]
        /smartcard [/user:UserName] program
      Display the trust levels that can be used:
      RUNAS /showtrustlevels
      Run a program at a given TrustLevel:
      RUNAS /trustlevel:TrustLevel program
</syntaxhighlight>key<syntaxhighlight lang="powershell">
  /noprofile        Do not load the user's profile.
                      This causes the application to load more quickly, but
                      can cause some applications to malfunction.
  /profile          Load the user's profile. (default)
  /env              Use the current environment instead of user's.
  /netonly          Use the credentials for remote access only.
  /savecred          Use credentials previously saved by the user.
  /smartcard        Load the credentials from a smartcard.
  /user              UserName in the form USER@DOMAIN or DOMAIN\USER
  /trustlevel Level  One of levels enumerated in /showtrustlevels.
                      RunAs is not able to launch an application with an elevated
                      access token.
  program            The program to run.
</syntaxhighlight>Enter the password when prompted.<!-- /profile is not compatible with /netonly.
/savecred is not compatible with /smartcard. -->

Revision as of 08:06, 19 September 2023

Runas

Execute a program under a different user account (non-elevated).

Syntax:

      RUNAS [ [/noprofile | /profile] [/env] [/savecred | /netonly] ]
         /user:UserName program

      RUNAS [ [/noprofile | /profile] [/env] [/savecred] ]
         /smartcard [/user:UserName] program

      Display the trust levels that can be used:
      RUNAS /showtrustlevels

      Run a program at a given TrustLevel:
      RUNAS /trustlevel:TrustLevel program

key

   /noprofile         Do not load the user's profile.
                      This causes the application to load more quickly, but
                      can cause some applications to malfunction.

   /profile           Load the user's profile. (default)

   /env               Use the current environment instead of user's.

   /netonly           Use the credentials for remote access only.

   /savecred          Use credentials previously saved by the user.

   /smartcard         Load the credentials from a smartcard.

   /user              UserName in the form USER@DOMAIN or DOMAIN\USER

   /trustlevel Level  One of levels enumerated in /showtrustlevels.
                      RunAs is not able to launch an application with an elevated
                      access token.

   program            The program to run.

Enter the password when prompted.