Red Gate forums :: View topic - Create native Windows Zip File using PowerShell
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation

Deployment Manager PowerShell Scripts forum

Create native Windows Zip File using PowerShell

Search in Deployment Manager PowerShell Scripts forum
Post new topic   Reply to topic
Jump to:  
Author Message
DatabaseJase



Joined: 20 Sep 2013
Posts: 7
Location: Northamptonshire

PostPosted: Fri Sep 20, 2013 11:12 am    Post subject: Create native Windows Zip File using PowerShell Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group