Switch Logged in user using powershell

SP 41 Reputation points
2021-01-09T01:54:49.94+00:00

Logging in as a Admin, I'm creating a Scheduled Task to be run as a User. The task when fired is run in background. However I need it to be run in foreground. I read that if the same user is logged in, Task Scheduler will run the same task in foreground. Even though Admin is logged in, using powershell, can we trick the scheduler that the user has logged in?

I tried changing below keys in register editor, but no luck.

HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\SessionData\2\LoggedOnUser

HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\SessionData\2\LoggedOnSAMUser

HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Server | User experience | Other
0 comments No comments

1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.