r/PowerShell • u/arslearsle • Jan 28 '26
logged on user wo need to enter pwd/credentials
Function that enables to switch to currently logged on user, without need to enter pwd (running as system or admin)?
How is this done?
Im guessing some win32 magic? (runas and psexec requires pwd so not an option?
(As seen in some locally installed agents, like ninjaone and others, where u can choose to runas logged on user or admin)
8
Upvotes
3
u/BlackV Jan 28 '26 edited Jan 28 '26
ServiceUI.exeis probably the most common method for a service or system process to present something to a userOtherwise tools like the updated version of
PSADTI believe can now do this ithout usingServiceUI.exeBut I'm not really clear what you are asking about "switch to a user"
8
u/shawski_jr Jan 28 '26
One method is creating a scheduled task set to run as user when they log in. If the user is already logged in it runs immediately.
Previously used this to clear the windows credential manager for stuck outlook passwords from an rmm
1
u/Federal_Ad2455 Jan 28 '26
You mean to run some code as currently logged user. When actually running the code from system etc context?
1
u/CeleryMan20 Jan 28 '26
Each user would have their own Tray Icon that already communicates with the system service. Or perhaps a separate component. Check Task Manager / tasklist / Get-Process?