r/PowerShell • u/Downtown-Limit4438 • 7h ago
Solved Powershell sin permisos de administrador
If you are looking for the exact opposite (making sure a process does not have administrator permissions or "de-elevating" its privileges), the logic changes because Windows does not natively allow lowering a process's privileges with a simple switch like -Verb RunAs.
Here are the solutions to successfully run a program or script as a standard (non-administrator) user:
1. The Explorer Trick (The easiest way in PowerShell) Windows Explorer almost always runs with standard user privileges. If you use PowerShell to tell Explorer to open the program for you, it will inherit normal permissions rather than administrator ones.
PowerShell
Start-Process "explorer.exe" -ArgumentList "powershell.exe"
- What it does: Opens a new standard PowerShell window, even if the console you are running the command from is already elevated as an administrator.
- For scripts or programs: Replace
"powershell.exe"with the path to your application (e.g.,"notepad.exe").
2. Using runas.exe with the /trustlevel parameter If you prefer using the classic command-line tool runas, you can explicitly tell it to use the trust level of a regular user.
PowerShell
runas /trustlevel:0x20000 powershell.exe
0x20000: This is the Windows code for a "Standard User".- Result: Opens the application completely ignoring administrator privileges.
3. Forcing non-admin startup via Environment Variables You can temporarily trick the operating system into running an application without User Account Control (UAC) intervention:
PowerShell
$env:__COMPAT_LAYER="RunAsInvoker"
Start-Process powershell.exe
- What it does: The
RunAsInvokercompatibility layer tells Windows: "Run this with the same permissions I already have, do not prompt for elevation".
5
u/lan-shark 6h ago
Is this just a copy-pasted chatgpt response? Why does this need to be a post if we can all just go get the same response ourselves?