![]() To run the PowerShell window with elevated permissions just click Start then type PowerShell then Right-Click on PowerShell icon and select Run as Administrator. #PSTip Start PowerShell as a different user with elevated privileges. ![]() Use an elevated command prompt to complete these tasks. ![]() ![]() An example of this would be if you wanted to run a PowerShell window with elevated permissions just click Start then type PowerShell then Right-Click on PowerShell icon and select Run as Administrator. As you can see, the script has detected that this PowerShell session is run as administrator. In Powershell >= 4.0 you can use requires statement at the top of your script to prevent a script from running as regular user: #Requires -RunAsAdministrator If the script is invoked from a non-elevated PowerShell process you’ll receive the following error: /// private const string PowerShellExecutable = "powershell.exe" /// /// Specifies whether to include user profile information as part of the PowerShell /// executing context. Now Press, CTRL + SFT + ENTER to open the PowerShell Window with Admin Privileges.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |