PowerShell Script for Unicorn Backup in Sitecore

Hi Champs,

Today I have created the PowerShell Script to create the backup of your Unicorn serialized folder. This script you can integrate with your local on server deployment or Environment setup plan.

 

Note: This is a PowerShell script you need save this with .ps1 extension and then you can utilize this.

 

Param(
[string]$environmentName
)
Add-Type -Assembly “System.IO.Compression.FileSystem”;
$sourceDir = “you have to mention your sourceDir”;
$targetDir = “you have to mention your targetDir”;
$date = (Get-Date -format “yyyyMMddTHHmmss”).ToString();

if (-Not (Test-Path $targetDir)) {
New-Item -Path $targetDir -ItemType directory
}

[System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDir, “$targetDir$environmentName$date.zip”);

 

Please write your note or queries in comment.

Thanks for Browning!!!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s