Microsoft Virtualization Discussions

Re: Script to list snapshot copies of all volumes

Hi justin_smith 

 

 

Could you please let me know how you have saved file "filername' for command $Controller = @('filername').

 

If possible could you please share script as well

Re: Script to list snapshot copies of all volumes

Hello @Neal1703,

 

He is simply using "filername" as a place holder here.  The "@()" turns it into an array so that  if there are multiple the bits of script below can loop over them.

 

$Controller = @('myNetApp.local.com', 'myOtherNetApp.local.com', 'myDRNetApp.remove.com')

 

@justin_smith,

 

You asked:  "m looking for it to save the file with the filername.snapshot. I've tried filername_snapshot and filername.snapshot, but it only gives it the $filer.snapshot name....."  You're seeing that behavior because of the single quotes around the value.  If you replace with double quotes it should work...

 

Get-NaVol | Get-NaSnapshot | select TargetName,name,Created | Export-Csv "H:\NetApp Scripts\$($filer).snapshots.csv"

 

If you're curious, there is a lot of information about variable expansion in string output here.

 

Hope that helps.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Forums