The following script creates a visual hierarchy to show the Host to Volume to Snapshot relationship.
PowerShell script:
Clear-Host $return = Read-Host -Prompt 'Enter the FQDN/IP to the Pure Storage FlashArray' $user = Read-Host -Prompt 'Username' $pwd = Read-Host -Prompt 'Password' -AsSecureString $pattern = Read-Host -Prompt 'Enter Snapshot pattern to destroy and eradicate (Eg. VSS-)' $FlashArray = New-PfaArray -EndPoint $return -Username $user -Password $pwd -IgnoreCertificateError $Initiators = Get-PfaHosts -Array $FlashArray Write-Host '============================' Write-Host "Hosts on $return" Write-Host '============================' ForEach ($Initiator in $Initiators) { Write-Host " [H] $($Initiator.name)" $Volumes = Get-PfaHostVolumeConnections -Array $FlashArray -Name $Initiator.name If (!$Volumes) { Write-Host ' | |----[No volumes connected]' } Else { ForEach ($Volume in $Volumes) { Write-Host " | |----[V] $($Volume.vol)" $Snapshots = Get-PfaVolumeSnapshots -Array $FlashArray -VolumeName $Volume.vol ForEach ($Snapshot in $Snapshots) { If (($Snapshot.name) -like "*$pattern*") { Write-Host "> | | |----[$pattern] $($Snapshot.name)" } Else { #Write-Host " | | |----[S] $($Snapshot.name)" } } } } }
Example output:
Enter the FQDN/IP to the Pure Storage FlashArray: 10.21.8.17 Username: pureuser ============================ Hosts on 10.21.8.17 ============================ [H] csg-ws2012r2-01 | |----[V] SQL-SysData | |----[V] SQL-TempDb | |----[V] SQL-UsrData | |----[V] SCVMMLibrary [H] csg-ws2012r2-02 | |----[V] RPTTST-Data01 | |----[V] RPTTST-Data02 | |----[V] RPTTST-Data03 | |----[V] RPTTST-Data04 | |----[V] RPTTST-Data05 | |----[V] RPTTST-Data06 | |----[V] RPTTST-Data07 | |----[V] RPTTST-Data08 | |----[V] RPTTST-Data09 | |----[V] RPTTST-Data10 | |----[V] RPTTST-Log01 | |----[V] RPTTST-Log02 | |----[V] RPTTST-Log04 | |----[V] RPTTST-Log05 | |----[V] RPTTST-Log06 | |----[V] RPTTST-Log07 | |----[V] RPTTST-Log08 | |----[V] RPTTST-Log09 | |----[V] RPTTST-Log10 [H] csg-vmw-01 | |----[V] Barkz-Datastore-1 | |----[V] Barkz-NFS | |----[V] Barkz-Datastore-2 | |----[V] Commvault-11-Library | |----[V] VSS-TEST-Volume1 > | | |----[VSS-] VSS-TEST-Volume1.VSS-1B4197D39C764E56913DD93951750185 > | | |----[VSS-] VSS-TEST-Volume1.VSS-C86073FF3C16449186B32E5D82F208E6 | |----[V] VSS-TEST-Volume2 | |----[V] Barkz-Ex13-Db-01 | |----[V] Mailbox-SMBR-MANUAL-01 | |----[V] Mailbox-SMBR-MANUAL-21 | |----[V] Dinesh001 [H] csg-vmw-02 | |----[V] Barkz-Datastore-1 | |----[V] Barkz-NFS | |----[V] Commvault-11-Library | |----[V] VSS-TEST-Volume1 > | | |----[VSS-] VSS-TEST-Volume1.VSS-1B4197D39C764E56913DD93951750185 > | | |----[VSS-] VSS-TEST-Volume1.VSS-C86073FF3C16449186B32E5D82F208E6 | |----[V] VSS-TEST-Volume2 | |----[V] Barkz-Ex13-Db-01
Download script https://github.com/barkz/PurePowerShellGuy.
Thanks,
Barkz