Switch User and Resume Script

I write scripts for Automation in windows using powershell scripting.

I have a scenario where i have to run a powershell script as one user then restart the system login as administrator and resume the script from where it left off .  

Once I login as administrator then i'll be deleting that local user from which I initiated the script that is why I am switching the user.

I know that once we switch user using a system restart the shell is also changed .

I know that it is possible to Reboot and Resume the script within the same user. 

How can I Reboot > Switch User (Administrator) > Resume running Script ?

Please HELP!! 

Parents
No Data
Reply
  • You can't. Each PS Session is user specific. In order to take further actions as another user, you must start a new session. You of course can start a session from an existing session. You must pass code to the next session that you want to run.

Children
No Data