Here’s a little tidbit that I previously shared on Twitter and Google Plus. The PowerShell ISE obviously has a Save menu choice. But there’s no menu option to save all open files. But you can add one yourself. All of the open files are part of the $psise.CurrentPowerShellTab.Files collection. Each item has a Save() method so to save all the files all you need to do is enumerate the collection ForEach and invoke the Save() method. You could run a command like this in the command prompt of the ISE.
Where you will run into problems is with files that have not been saved yet and are still untitled. This code will throw exceptions. The solution is to simply skip untitled files.
You can save untitled files with the SaveAs() method but you have to provide a file name. I can’t find anyway to easily invoke the GUI prompt so for now I have manually save untitled files.
Now, instead of running this command every time, let’s add it to the ISE Add-Ons menu.
I even added a keyboard shortcut. Add these lines to your PowerShell ISE profile and you’ll always have this menu option. Or download Add-SaveAllISE.ps1 and load the script in your profile. As far as I can tell this works in both PowerShell v2 and v3.