Save system state and reboot using PowerShell

All, I am looking for a function which can save the list of all open programs, reboot and open up all the saved programs which were active prior to reboot. how can I achieve this using PowerShell.

Thank you!

A couple of things. System State involves a LOT more than just the open applications, so I am going to assume you meant just what is up and running rather than the whole system state.

Secondly, it is going to depend on how deep you want to go, and what exactly you have running. For example, to pull every process you have running, along with the file path for that process, is pretty simple:

Get-Process -IncludeUserName |
    ? {$_.UserName -match "<userName>"} |
        Select ProcessName, UserName, ID, @{n="Path";e={$_.Path}} |
                Out-GridView

But if you run this you’ll notice you’re literally capturing everything running for that user (in my case, 18 Chrome Windows, my IntelGraphics card process, VMWare, etc.). Additionally you will capture a lot of processes you don’t necessarily want to try starting manually: svchost, RuntimeBroker, etc. So you will likely have to do a lot of parsing to filter out what you don’t want. But this should get you started.

Once you have your list, you can simply run the code above after a restart, and compare the returned arrays.

1 Like

Is what you want to do not the default behavior of Windows 10? Am I missing something?

2 Likes

thank you @jlogan3o13 and @tonyd.

Correct @jlogan3o13, I was looking for only open applications like chrome, outlook, word etc…I would like to build a function which will take the snapshot of open applications, store it in temp location, reboot the machine and open up all the saved list of applications.

@tonyd - on my work m/c, the applications opens up after the reboot followed by a software push or force reboot. but, on my personal m/c it does not happen that way. Windows starts-off fresh and I need to re-open the application I chose to work. Is there any setting that I need to change to enable that functionality?

Thank you!

Wouldn’t it be much better to figure out why your personal m/c - BTW: what does m/s stands for? - does not work as it should be instead of working with a quirky script around?

It’s a little bit like you have a flat tire and you’re looking for something like a small furniture mover to put your flat tire on top of that instead of fixing the hole. :wink: :stuck_out_tongue_winking_eye:

You could try having a look here:

This tells how to prevent them, you want to check and do the opposite, or make sure it is at the default. Make sense?

2 Likes

thank you @tonyd, for the input…