Opening PowerShell as an administrator will give you the ability to execute scripts with administrative rights. To speed up your skills, you have to know how to run PowerShell as an Administrator in different ways, especially if you are using Windows Server 2022. For example, you are running commands in Command Prompt, and you need to open PowerShell. You should be able to open PowerShell directly from Command Prompt instead of minimizing Command Prompt and opening PowerShell in another way.
Run PowerShell as Administrator From Graphical User Interface
The Windows Server 2022 comes with two major types, Desktop Experience, and Core versions. The Desktop Experience editions will allow you to do tasks in a graphical environment, but using the core versions, you have to run PowerShell, and CMD commands.
Start Menu: to open PowerShell with administrative capabilities from the start menu, click on the Windows icon or press the Windows key. Right-click on Windows PowerShell, then click on Run as administrator.
Search Bar: if for any reason you unpin PowerShell from the Start menu, you can open it from the windows search bar. Type Windows PowerShell in the search bar, right-click on it, then click on Run as administrator.
Windows Run: press Win+R to open the Run, type PowerShell in it, then press Ctrl+Shift+Enter.
It is easy to run PowerShell using GUI tools, but sometimes you are not in the graphical interface. A good example is Windows Server core editions. You must know how to run PowerShell from the command line interface.
Click on this article to learn how to replace PowerShell with cmd in Windows 10?
Run Powershell as Administrator From Command Line Interface
In non-GUI windows operating systems, you will have to use Command Prompt and PowerShell to do tasks. There is no Run or Start menu to open PowerShell. You will use Command Prompt.
Command Prompt: Open Command Prompt, type PowerShell, and press Enter key. The PS will be added at the beginning of your commands. It means you have opened PowerShell but not as an administrator. Execute the Start-Process PowerShell -Verb runAs
command. Enter a username and password with administrative access.
PowerShell: if you opened PowerShell on your computer and want to open it as administrator. Just execute the Start-Process PowerShell -Verb runAs
command, then enter the administrator user name and password.
The ability to work in both GUI and CLI is important for everyone using Windows Server. I hope that I can cover every detail about how to run PowerShell as an administrator in Windows Server 2022.
Learn more about PowerShell.