Creating Volumes from Protection Group Sources (Part 2)

InĀ Part 1 of creating volumes from Protection Group (PGroup) sources I discussed how to get a specific snapshot to use for a disaster recovery (DR) restore. In the case of having a more automated DR workflow retrieving the latest snapshot from the PGroup is a key requirement.

The below PowerShell script example removes the manual task of picking a specific PGroup snapshot like in Part 1.

# Connect to FlashArray.
$f = New-PfaArray -EndPoint 10.0.0.1 -Credentials (Get-Credential) -IgnoreCertificateError

# Get latest PGroup Snapshots.
$psoPGroup = Get-PfaAllVolumeSnapshots -Array $f | where {$_.Source -like "*Barkz-Bootlun-06-WS2016-DC-GUI-6*" -and $_.Name -like "*z-nightly-replica-to-PureTEC*"}
ForEach ($PGroupSnapshot in $psoPGroup) {
  If ([DateTime]($PGroupSnapshot.created) -gt (get-date).addHours(-8)) {
     Write-Host $PGroupSnapshot.name " -- " $PGroupSnapshot.created
  }
}

Note: You will notice that the Get-PfaAllVolumeSnapshots does not return a PSObject and the “created” field is returned as a string. Using [DateTime] I convert the string to a datetime and then compare that to get snapshots >8hrs.

Output:

z-nightly-replica-to-PureTEC.158.Barkz-Bootlun-06-WS2016-DC-GUI-6 -- 2017-10-20T15:49:00Z
z-nightly-replica-to-PureTEC.159.Barkz-Bootlun-06-WS2016-DC-GUI-6 -- 2017-10-20T17:39:00Z

Thanks,
Barkz

 

One comment

Add Comment

Required fields are marked *. Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.