Skip to main content


Showing posts from March, 2016

How to Zip and UnZip files using PowerShell

Today we are going to Learn all about Compressing and Decompressing a file using Powershell. So lets get started. Powershell 5.0 have lots of features added to its feather. One of them is Zipping and Unzipping . Powershell 5.0 contains 2 functions by default for Zipping and Unzipping a file i.e. Compress-Archive and Expand-Archive Syntax : Zip   :   Compress-Archive -path <Source_File_Path> -DestinationPath <Destination_File> Unzip : Expand-Archive -path <Zip_file_path_to_Extract> -DestinationPath <Destination_path_where_to_Extract>   >_ If you are using Powershell version below 5.0 then you can achieve the same by Calling a Class. ZIP - FILE Add-Type -Assembly "System.IO.Compression.FileSystem" ; [System.IO.Compression.ZipFile]::CreateFromDirectory("E:\The Powershell Geek", "E:\") UNZIP -FILE Add-Type -Assembly "System.IO.Compression.FileSystem" [System.IO.Compression.ZipFil

Execution Policy in Powershell

How to get and set the Execution Policy Execution Policy in Powershell Execution Policy in Powershell helps to determine the type of scripts that can run on a particular system.  There are different types of Execution Policy in Powershell : 1. RESTRICTED It is the default execution policy in Powershell. It means it doesn't allow any Powershell script(*.ps1) to execute by default. In order to provide security, Microsoft suggests Restricted policy by default so that none of malicious code can be executed by double clicking or running it.  2. ALL SIGNED  All the Scripts should have a digital signature from a trusted publisher, then only you will be able to execute the Script else Script will not be executed. This is applicable for the local scripts also which you write of your own, you will need to assign a certificate to it example Self Signed Certificate . 3. REMOTE SIGNED Local script files doesn't need any signature( they can be executed) but script