All Pages

Tuesday, March 2, 2021

How To Automate SnapCenter Snapshot Mounting & Unmounting using PowerShell

How To Automate SnapCenter Snapshot Mounting & Unmounting using PowerShell

In this post we are going to see how to mount SnapCenter snapshots using PowerShell Cmdlets.

Scenario: We would like to backup the snapshots (Created by SnapCenter) data using one of backup application. Before we were used to have SnapManager with SnapDrive Commands. In SnapCenter Snapdrive may not work as expected, frequently we get timeout error.

In order to do this we need atleast SnapCenter version 4.4.

Create a secure string out of user password

> read-host -assecurestring | convertfrom-securestring | out-file c:\mysecurestring.txt

After creating the Secure string use below powershell cmdlets to establish connection with SnapCenter

$pass = cat C:\mysecurestring.txt | convertto-securestring 
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist "Domain\UserName",$pass

Open-SmConnection -Credential $mycred -SMSbaseUrl https://SnapCenterIP:8146

Now Mount the snapshot using below command

Mount-SdSnapshot -Path SVMNAME:/vol/Volume/Lun -Snapshot SnapShotName -MountPath E: -Host BackupServer.domain.com

You can Un-Mount the mounted snapshot using below command

Dismount-SdSnapshot -Path "E:" -Host BackupServer.domain.com

That's it. You can use the same scripts as Pre and Post for your backup application

Comment your feedback

No comments:

Post a Comment