Automating deployments can save you a great deal of headaches and even trauma in some cases. However I found it disappointing when I actually tried to put the best practice of automating deployments into practice.
I needed to make a backup copy of the production folder and then overwrite the live copy with the tested copy from the QA environment. Much to my dismay, I couldn’t find any publicly available and publicly licensed PowerShell scripts to do this job.
I created the below module to do just that.
- Backup folder is datetime stamped in a consistent manner
- Makes troubleshooting simpler
- More straight forward rollbacks
- Different domains necessitated the use of
New-PSDrive. It does still work on the same domain though.
- Excluding the web.config to preserve environmental configuration/differences.
- Delete backups older than 7 days so your infrastructure team doesn’t have to ask you why the drive is full.