7 Zip Compress directory

 

# This script can be used to zip a dirctory with plain powershell.
$source = "C:\temp"
$destination = "D:\temp.zip"
 
If(Test-path $destination) {Remove-item $destination}
Add-Type -assembly "system.io.compression.filesystem"
 
[io.compression.zipfile]::CreateFromDirectory($Source, $destination)