Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions Links


SQL Server DBA Jobs

How to unzip in Powershell

07 February,2019 by Tom Collins

Question: I have a zip file , which I normally  win-zip or unzip . I'd like to unzip an archive file as part of a Powershell script


Answer: You can use the Powershell cmdlet - Expand-Archive . I've also included some added bits around the  ps cmdlet Expand-Archive , which will assist in managing access  & file clean up .


# Unblock if there's a block – common problem

Unblock-File   -ErrorAction SilentlyContinue


#the actual expand process

Expand-Archive -Path -DestinationPath e:\exsample\sql_server\modules -Force


#to remove your zip file

Remove-Item -Path


Read more on Powershell scripts

Powershell Script Library for DBA (SQL Server DBA)

Expand your Powershell mind – Three key cmdlets


Author: Tom Collins (


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on How to unzip in Powershell | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer