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