I have a ps script that I am running as a window service using instsrv and srvany from Resource Kit. If I logon remotely to the machine and then logoff powershell remains running. If I logon via the console the powershell script is still running. However if I logoff from the console, powershell terminates.
I created a very simple script that just writes to log file and I get the same behaviour, I can login and out remotely via remote desktop and it stays running. As soon as I login via the console and then logout, powershell terminates on the console logout