How to Switch User Using PowerShell

Sheeraz Gul Feb 02, 2024
How to Switch User Using PowerShell

This tutorial demonstrates how to switch users using PowerShell.

PowerShell Switch User

We switch the current user to another using the PowerShell or Command prompt. The command is the same for both terminals, but PowerShell communicates with Windows directly and can perform many tasks.

Follow the steps below to switch the user using PowerShell:

  • First of all, open PowerShell as an Administrator. Search PowerShell in the Start menu, right-click on the PowerShell icon and click Run as Administrator.
  • Run the following command in PowerShell with the user name you want to switch to.
    runas /user:UserName\ explorer.exe
    
  • Here, the user name will be the user you want to switch to.
  • After running this command, it will ask for the user’s password.
  • Insert the password and click Enter, and the user will be switched.

Let’s try an example based on the above steps.

runas /user:Sheeraz\ explorer.exe

The above command will try to switch to the user Sheeraz. It will ask for the password.

See the output:

Enter the password for Sheeraz\:

Once you enter the password and press Enter, the user will be switched to Sheeraz.

If this is not working for you, in any case, we can also use PowerShell to get access to the lock screen and switch the user from there.

See the steps:

  • First of all, open PowerShell as an Administrator. Search PowerShell in the Start menu, right-click on the PowerShell icon, and click Run as Administrator.
  • Run the following command:
    tsdiscon
    
  • The above command will take you to the lock screen page.
  • On the lock screen page, you can select any user based on the user, either with or without a password.
  • Once you select the user, the user will be switched.
Author: Sheeraz Gul
Sheeraz Gul avatar Sheeraz Gul avatar

Sheeraz is a Doctorate fellow in Computer Science at Northwestern Polytechnical University, Xian, China. He has 7 years of Software Development experience in AI, Web, Database, and Desktop technologies. He writes tutorials in Java, PHP, Python, GoLang, R, etc., to help beginners learn the field of Computer Science.

LinkedIn Facebook

Related Article - PowerShell User