How can an elevated PowerShell script launch another script without admin rights?

August 7, 2026 4 answers
Asked by MellowPine42
I have a PowerShell script that runs with elevated administrator privileges. At the end, it needs to start a second script in the currently logged-on user's normal, non-elevated context. I've tried starting a new process and invoking PowerShell, but the child process keeps inheriting the administrator token. What's the best way to launch the second script without elevation?

Answers

AmberQuill26
Another option is to use a user-context trigger. Have the administrative script signal an event, and have a process already running in the user session listen for that event and launch the non-elevated script. This avoids trying to downgrade an already elevated process directly.
Reply to this answer
QuietHarbor7
A scheduled task can handle this, especially if you configure it to run under the target user account without elevated privileges. It requires a little setup, but itโ€™s a reliable option for scripts that run during user-management workflows.
Reply to this answer
SilverMaple53
For a script that must begin elevated, you can launch a new process using the logged-on userโ€™s Explorer process as its parent. Explorer normally runs unelevated, so the child process receives the userโ€™s standard token instead of inheriting the administrator token. A PowerShell process-management module such as ProcessEx can use Explorerโ€™s startup information for this purpose. Find the Explorer instance with the same session ID as the logged-on user, then use it as the parent when starting the second PowerShell script.
Reply to this answer
CobaltVessel18
Itโ€™s usually easier to reverse the flow: start the main script in the normal user context, have it launch the administrative portion with elevation, wait for that to finish, and then continue with the non-elevated steps. That way the final process doesnโ€™t inherit an administrator token.

MellowPine42: The first script is triggered automatically when a user is terminated. Iโ€™ll test this approach and see whether it fits that workflow.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions