Open Elevated PowerShell Prompt Here From Right-Click Context Menu Instead Of Command Prompt Here As Administrator In Windows 10

#Open Elevated PowerShell Prompt Here From Right-Click Context Menu Instead Of Command Prompt Here As Administrator In Windows 10

#Run these commands to enable an elevated Elevated PowerShell Prompt Here also known as PowerShell Here as Administrator when right clicking on a folder in Windows Explorer. These commands all work in both PowerShell and PowerShell Direct.

#Just the code:


#The Long Story…

#HKCR: does not work in this example and you do not need to mount first. This method accesses the registry directly. Many instructions say to use New-PSDrive to mount HKCR: first and use that convention to access it to do many things but none of that is needed.

#Get-PSDrive will show you what is mounted.

#▲As you can see there is no HKCR:

#Moving on…

#If done properly launching Elevated PowerShell Prompt Here will trigger a UAC prompt. This is normal and good. Create all the keys and values by typing the following commands in order:

#This works when right-clicking only on folders in Windows Explorer and not drives or drive letters.

#Create the User’s file folder (from the Desktop Experience feature) on the Desktop of all new and current users

#Run this to create the User’s file folder (from the Desktop Experience Feature) on the Desktop of all new and current users. After that you will always have a folder nearby to single right-click on to launch an Elevated PowerShell Prompt Here session.

# Since HKLM is mounted already I can use the short path to manipulate the registry entries.

user folder created with registry change using microsoft powershell should appear on your Desktop after using F5 to refresh or on log off /reboot. Use the commands above to right-click and launch an elevated PowerShell prompt starting with the selected folder as a starting point.