I'm looking for a way to run processes as the currently logged-in user without needing to enter their password. Is there some Windows magic that allows this? I know the usual methods like runas or psexec require a password, which isn't what I want. I've seen tools like NinjaOne allow you to run a command prompt or PowerShell terminal as either the logged-in user or as an admin. Is there a native method without needing external tools?
4 Answers
One popular method is to use ServiceUI.exe, which is commonly employed to let a service or system process display something to the user. There are also updated tools like PSADT that can handle this without depending on ServiceUI.exe. Can clarify more if you're looking for something specific about "switching to a user."
Thanks! Looks like the syntax would be something like ServiceUI.exe -user:CONTOSOjdoe powershell.exe, but I’m trying to find a method without relying on external commands.
It sounds like you want to execute some code using the currently logged-in user's context while running from a system account. That's definitely something you can do!
Exactly, I want to do it without asking for the user's password. I've noticed programs like NinjaOne let you start processes as the logged-in user or as an admin, and I’m curious how they achieve that.
Each user can have their own Tray Icon that interacts with the system service. Alternatively, you could check the task manager or use commands like tasklist or Get-Process to manage things more effectively.
Another approach is to create a scheduled task that runs under the user's profile set to trigger when they log in. If they’re already logged in, it can run right away. I’ve used this previously to manage stuck Outlook passwords by clearing the Windows credential manager through RMM.

Got it! I think PSADT starting processes as the current user is what I need, but it can't launch admin tasks in a standard user's session, right? But yeah, I need something more direct, potentially using Win32 API calls or something.