Automatically Saving Workspace

One of the most powerful ISESteroids features is its capability to save and restore your entire workspace, including open editor panes, breakpoints, and the state of collapsed regions.

One of the most powerful ISESteroids features is its capability to save and restore your entire workspace, including open editor panes, breakpoints, and the state of collapsed regions.

You can use this feature to freeze your work environment…

  • …each time you close ISESteroids and restore it the next time you launch ISESteroids
  • …just once on demand, for example because you want to restart ISESteroids or change Administrator Privileges

Freezing your workstate also enables you to quickly restart ISESteroids, for example to release all memory, start a test in a fresh environment, or fix other problems.

Automatic Restart

With a click of a button, ISESteroids saves your entire work environment including all open editors and unsaved work, closes ISESteroids and restarts it:

Image

After the restart, your entire work environment is restored to the state before, so all scripts are reloaded, and breakpoints and collapsed regions are restored.

Restoring your work environment after a restart is a feature of ISESteroids, so it takes place only once ISESteroids is loaded. Since you added Start-Steroids to your profile script, this is now taken care of automatically.

There are a number of good reasons why such a restart can be helpful:

  • You have worked for a long time and would like to release all memory
  • You want to test-drive your script in a fresh PowerShell environment to make sure no left-overs (variables, functions, etc.) from previous work affect your testing
  • Something does not work right (including ISESteroids features), and you want to give ISE and ISESteroids a chance to start freshly

Switching Admin Context

Restarting your work environment can also be helpful if you decide to enable or disable your Administrator Privileges:

  1. Hold down CTRL, then click the red restart button.
  2. ISESteroids conserves your work environment and shuts down. Because you pressed CTRL, it will not automatically restart.
  3. Restart ISE manually, either with or without Administrator Privileges. Your work environment is restored, and you can now continue working with the new privileges.

Please note: when you switch your Administrator Privileges, you also switch your Windows Network Drives (mapped drives). Any script that was located on a network drive may no longer be accessible and will not load back into the ISE.

The same approach can be used if you want to shut down your work environment after a busy day, and continue tomorrow: when you hold CTRL while you click the red restart button, the saved work environment is kept until the next time you launch ISE, right away or in a couple of days.

You cannot switch users this way: the saved work environment is stored in your personal user profile ($env:appdata), so when you switch identity, you also switch your personal user profile and have no longer access to the saved work environment.

Automatically Saving Work Environment

If you want ISESteroids to save your current work environment each time you close ISE, follow these steps:

  1. Hold CTRL and keep it pressed, then close the ISE window. ISE routinely asks if you want to save any unsaved work. By holding CTRL, you can disregard this dialog and click No because ISESteroids is going to save your entire work environment, including all unsaved work.

  2. A new dialog opens, and you can choose whether you want to save your workstate once, always, or whether you want to turn off this feature again.

    Image

  3. Choose Save Workstate Always. Then click OK.

From now on, whenever you close ISESteroids, your entire workstate is saved and restored when you launch ISESteroids again.

If this feature is enabled, and there are unsaved scripts when you close ISESteroids, they will always be saved as part of your workstate. So if you want to get rid of open scripts, make sure you close them before you close ISESteroids.

If you want to turn the feature off again, follow the same steps and choose Do not save workstate on close instead.