Thursday, May 19, 2016

PowerShell cmdlet of the Day : Expand-Archive

 

Yes, Yes, this was the most awaited cmdlet in the PowerShell world... Wow!! it's one of the coolest command ever exists for system admins.

Now , we can write scripts to unzip ZIP files, I mean, can write more efficient scripts to unzip files ( without using .net code).

Ok! let's be less dramatic.

If you want to unzip a zip file using PowerShell, then there is a cmdlet available for it, named Expand-Archive.

It's syntax  is simple, provide the path of .Zip file, then the path of Destination where you want to extract files. that's all!

Expand-Archive -Path C:\Users\aman.dhally\Desktop\PingData.zip

-DestinationPath C:\temp\Data\ -Force -Verbose

In the above command, we are unzipping the PindData.zip to the folder C:\temp\Data. The parameters are quite self-explanatory.

m1

In the above screenshot you can see that the above command has run successfully and it' unzip the archived.

Now you can write script to unachieve your backups. :D

:)

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel
for PowerShell video tutorials. You can download all of my scripts from “Microsoft
TechNet Gallery”.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.