On Windows 8.1, I have a service that runs PowerShell scripts. The service starts as "nt authority \ system" in session isolation 0. Any process that I create from PowerShell starts as "nt authority \ system" in session 0 isolation.
I need to run a script that is under a user account outside of session 0, not the system account. I tried this
Start-Process "$PsHome\PowerShell.exe" -Credential $pp -ArgumentList $script -wait
and PsExec, determining which session I want to use with the argument "-I 1".
& PsExec.exe "Install.bat" -i 1 -accepteula -u "domain\user" -p "awesomePassword" -w "startdir" -h
I tried the "Allow service to interact with the desktop" setting.
I keep getting Access when I try to start a process from either PowerShell or C # service.
Here is an example of an exception when I try to escape using C # in a service.
System.ComponentModel.Win32Exception (0x80004005): Access is denied at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
How to escape from session 0?
I can rewrite C # code to start the process under another user. or I can overwrite the called PowerShell script to start another process as a user. No matter what I try, I cannot break out of session 0.
source share