Array Performance and Data Protection
1753876 Members
7328 Online
108809 Solutions
New Discussion юеВ

Re: Powershell script to sell all Snapshot

 
SOLVED
Go to solution
Francois lepage
Occasional Advisor

Powershell script to sell all Snapshot

I want to use powershell to list all snapshot beginning by Ncss on all volumes

I can't find how to do it for all volumes but I am able to do it for one volumes with this command

   Get-NSSnapshot -vol_name "NMBL-DBEX-SIEGESOCIAL" | where {$_.name -match "NSs"}

Is it possible to achieve my goal

thanks

4 REPLIES 4
dgonzalez59
HPE Blogger

Re: Powershell script to sell all Snapshot

Hello Francois,

There are several ways to script this. Here is an example, where we first get volumes, and then pass the output through a foreach loop. In the sample below, I am focusing on volumes that have 2017-06-09 in the snapshot name.

Dianne

Sample script

Connect-NSGroup -Credential $nm_cred -group $nsarray

$volname = Get-NSVolume | Select-Object -Property "name"

$snaplist = @()

foreach ($name in $volname)

{

$res = Get-NSSnapshot -vol_name $name.name | where { $_.name -like "*2017-06-09*" } | select name, id

$snaplist += $res

}

Write-Output $snaplist

Chris_Lionetti
HPE Pro
Solution

Re: Powershell script to sell all Snapshot

Dang, She beat me to it..

From the CLI, this will check all volumes, and all snaps of those volumes;

Get-NSVolume | foreach-object { get-nssnapshot -vol_name $_.name | where {$_.name -match "MyTestString" } }

Chris Lionetti
Francois lepage
Occasional Advisor

Re: Powershell script to sell all Snapshot

thanks it is working!! If I could put 2 solutions as the correct answer you will be marked as that too

thanks again

Francois lepage
Occasional Advisor

Re: Powershell script to sell all Snapshot

Thanks also working!!!