PowerShell - Compress-Archive

Published: 09 September 2020
on channel: Mr Automation
955
9

(how to backup files with powershell using compress-archive)

*compress-archive
*how to backup files with powershell

In this video i show you how you can use compress-archive to create a nice powershell backup script/function

Code :
param(
[Parameter(Mandatory=$true)] [string] $folder
#[Parameter(Mandatory)] [string] $zipfile
)
#we need to do some magic to get the date for instance.

$date = get-date -f "yyyy-MM-dd__hh-mm-ss"
$zipfile = $folder + "-$date.zip"

Compress-Archive -Path $folder -DestinationPath $zipfile


Watch video PowerShell - Compress-Archive online, duration hours minute second in high quality that is uploaded to the channel Mr Automation 09 September 2020. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 955 times and liked it 9 visitors.