Today’s challenge is targeted at advanced PowerShell users, but The Chairman hopes you will tackle as much of it as you can. Even solving a few pieces of the challenge will add PowerShell skill points. And you might even have a little fun. This challenge may be unique in that there probably isn’t a 100% solution. You might also have to think outside the box and get creative.
The challenge has two parts and will require scripting. You can either write a set of PowerShell scripts or functions. You might even write a module. The task is to export or save a PowerShell session to a file or set of files that you can later “import” to recreate the original session. Items to take into account include:
- loaded modules
- defined variables
- command history
- defined aliases
- $host customizations
- PSReadline settings
- Prompt and other non-module functions
The concept is that you can “save” your current PowerShell console session and later “re-open” to where you left off. As mentioned, it is unlikely you’ll find a 100% and seamless solution, but get as close as you can. You can assume that you are exporting and importing on the same machine.
You can work with either Windows PowerShell or PowerShell 7.x.
As always, submit links to your work in the comments. Time to get packing. Good luck.