Create native Windows Zip File using PowerShell

Share your PowerShell scripts for Deployment Manager

Moderators: Mike Upton, justin.caldicott, csmith, chirayu, DavidSimner

Create native Windows Zip File using PowerShell

Postby DatabaseJase » Fri Sep 20, 2013 11:12 am

While developing some custom deployment scripts I had a need to create a ZIP archive of the current deployment (using PreDeploy.ps1) because we deploy into the same folder each time (i.e. not taking full advantage of the way Deployment Manager normally creates a <version> type hierarchy).

This was easy at first, I found some PowerShell code to create the archive, but then I realised it was an asynchronous process meaning the PS script carried on even though the archive was still being created. I tried the usual native PS tools for starting jobs, etc, but that didn't work. After some hunting I found this amazing PS code that starts the archive then loops until the exclusive lock has been released on the zip file but also checks the number of files compressed to ensure no files were skipped.

I've spoken with Alex Yates who suggested I post a link to the website so here you go:

http://www.technologytoolbox.com/blog/jjameson/archive/2012/02/28/zip-a-folder-using-powershell.aspx

I'm not going to paste the code here but I am going to post a comment on that blog post to see if it's possible to attach the code in case the post is lost in the future.
DatabaseJase
 
Posts: 7
Joined: Fri Sep 20, 2013 10:53 am
Location: Northamptonshire

Return to Deployment Manager PowerShell Scripts

Who is online

Users browsing this forum: No registered users and 0 guests