0

Running the powershell.exe at "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" will always run it as Administrator, even though there is no possible way to check the "Run as Administrator" tickbox as there are no Compatibility options in the properties. Is there a way to stop this?

3
  • 2
    How are you launching Powershell?
    – squillman
    Aug 18, 2022 at 21:08
  • Please look up the various methods of running as admin. There are places other than Compatibility options. Aug 19, 2022 at 4:43
  • Launching Powershell from any source, although I usually use the Win + X or even when Shift clicking to open powershell in explorer. I checked the shortcut for Group3 in WinX, and even unticked both "run as admin" boxes but they always run as admin.
    – John
    Aug 19, 2022 at 8:17

2 Answers 2

2

Turns out my UAC was set to "Never Notify" and would launch admin powershell without a prompt. After enabling it at least one tick up, it would then correctly launch unelevated.

0

PS will always run un the user context that started it.

So, if you are logged in as 'Admin', then of course all things run as admin.

If you are saying, you are logged in as a normal user and you select the built-in default PS (ISE/PowerShell/pwsh) shortcuts, and you get the elevation prompt to continue as admin, then something in your environment set it that way.

The other space where this can happen is if you (or someone else) set in in your PS launch profiles using the 'Requires flag'.

C:\Users\...\Documents\WindowsPowerShell\Profiles
C:\Users\...\Documents\PowerShell

about_Requires https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_requires?view=powershell-7.2

Or you are using a customer shortcut, and the RunAs switch is part of that command of that shortcut or the properties is set that way.

https://stackoverflow.com/questions/12159935/why-does-powershell-always-run-as-admin-now

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .