PowerShell Studio: Form and Script Recovery
- Written by David Corrales
- Last Updated: 14 April 2016
- Created: 20 October 2014
- Hits: 3559
Once in a while our support team gets a request to recover a script from a packaged executable because the original was lost. In fact this just happened recently when a user contacted us to recover his lost form project from his packaged script. We were able to recover the script, but unfortunately the user still had to rebuild all his GUI forms from scratch. He was at least fortunate enough to be able to copy and paste the script portions of his project without having to completely rewrite it all.
Please don’t find yourself in the same situation.
For our public service announcement we present you with these preventative steps to save you from disaster and wasted time:
1. Enable Recovery Data
PowerShell Studio has the option to include recovery data in your exported scripts. This recovery data allows you to reconstruct your original form file or project from the exported script.
For more details on the recovery feature please refer to the Form Recovery blog article. This option is enabled by default when you start PowerShell Studio for the first time.
The recovery feature is all well and good, but it will not help your if you hard drive crashes and you never copied the exported script to another location; therefore we go onto step 2.
2. Backup your scripts and use Source Control!
I can’t stress this enough: Backup frequently! This is made easier when using versioning tools such as VersionRecall. These tools will help save your rear and hours of work by allowing you to easily recover files from a repository. If you accidently override a file, you can roll back the file to a known previous working state. You can even restore the file if you accidently deleted it. It is very important to keep your repositories and backups on a separate storage device so that you can recover your scripts when your local hard drive crashes. VersionRecall has a very useful feature where you can specify a secondary storage location, which can be a lifesaver if your primary storage device ever fails.
Redundancy is good and that brings us to the next optional step.
3. Use the Cloud
Another option is to utilize cloud services such as Dropbox or OneDrive as an additional backup method. This may be a viable option if your scripts are not sensitive and your company’s policies permit it. Cloud services can also be used in conjunction with versioning tools such as VersionRecall to add an additional layer of protection. It is important to note that some cloud services only store previous versions of a file for a short time; therefore it may not be the best tool for keeping track of versions. Some services do offer special packages that allow you retain the previous versions during the life of your subscription.
I know there are some people out there that don’t believe they need to version or backup their scripts, but the day their hard drive crashes and they have an impending deadline, they will wish they did. So if you follow these steps, you can sleep better at night knowing that your scripts are safe and you have a recovery strategy.