Microsoft Virtualization Discussions

How to search snapshots from list of filers :S

RITESHPARAB
4,140 Views

Hi PowerUsers,

Aim : To find Volumes (from list of filers) where more then hourly.30 snap exists.

I have found a script in NA communities, which I modified as per my requirement, but I stuck in middle of d script.

The script works perfectly, only thing is pending is how I can exclude some volumes from some filers. 

e.g. : If I have 2 filers where each one have 8 vol. but I want to exclude vol3 and vol4 from 2nd filer.

Attached : Script[draft], Result

Please help.

1 ACCEPTED SOLUTION

vinith
4,140 Views

Hi Ritesh,

You need to use powershell filtering to exclude these volumes, please find attached the modified script and let me know how it goes.

Here are the modifications which i made in the script.

Based on your scenario i have appended another controller "192.168.1.23" which is the one from which you need to exclude vol3 and vol4

$NetappList=("192.168.1.22","192.168.1.23")

Next im checking for the IP address present in $global:CurrentNaController, if it matches 192.168.1.23 then $filteredvolumes variable would consist of all volumes from get-navol except vol3,vol4 (which you can modify with your volume names)

else if the IP Adress does not match the criteria it goes about doing the normal get-navol query.

if (($global:CurrentNaController | select -ExpandProperty address).ipaddresstostring -match "192.168.1.23")

{

$filteredvolumes = get-navol | ?{$_.name -notmatch "vol3" -and $_.name -notmatch "vol4"}

}

else

{

$filteredvolumes = get-navol

}

            $filteredvolumes | foreach-object {

                  $ParentName=$_.Name

.......

Continued

Do let me know if it works out and solves your need

View solution in original post

3 REPLIES 3

vinith
4,141 Views

Hi Ritesh,

You need to use powershell filtering to exclude these volumes, please find attached the modified script and let me know how it goes.

Here are the modifications which i made in the script.

Based on your scenario i have appended another controller "192.168.1.23" which is the one from which you need to exclude vol3 and vol4

$NetappList=("192.168.1.22","192.168.1.23")

Next im checking for the IP address present in $global:CurrentNaController, if it matches 192.168.1.23 then $filteredvolumes variable would consist of all volumes from get-navol except vol3,vol4 (which you can modify with your volume names)

else if the IP Adress does not match the criteria it goes about doing the normal get-navol query.

if (($global:CurrentNaController | select -ExpandProperty address).ipaddresstostring -match "192.168.1.23")

{

$filteredvolumes = get-navol | ?{$_.name -notmatch "vol3" -and $_.name -notmatch "vol4"}

}

else

{

$filteredvolumes = get-navol

}

            $filteredvolumes | foreach-object {

                  $ParentName=$_.Name

.......

Continued

Do let me know if it works out and solves your need

RITESHPARAB
4,140 Views

Hi Vinit,

I have checked your script and it's worked fine, it's solved my problem.

however, I have also found one more way to accomplish my task using CSV(att.) 

Thanks for your time and help 

vinith
4,140 Views

Thats great awesome!!.

Public