This script has found itself being used for many other purposes than originally intended, not sure why it has taken me so long to post it! It was written to provide for an easy way to zip all of our IIS logs, and have them grouped by month created. It was originally setup to append .zip files with new data as needed but ,due to a bug in the write-zip cmdlet, I have changed it to ignore the last month of logs. I will leave the commented out code in this script, just in case they eventually fix the bug.
As part of our deployment process, we make a backup of our sites. This is to ensure that we can restore quickly should something go wrong without having to roll to our disaster recovery process. As part of writing this script, we wanted to make sure that we only kept the latest 3 backups. This script was meant to be daisy chained with others in our push process, I’ve left those check in place as someone might find them useful for their own scripting.