Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Hi
I'm looking to generate a script that will report the snapshots that have the busy,luns dependency across our netapp filers.
At present the below syntax which is being written for a filer by filer basis displays the busy luns in the dependency and snapshot name property as required.
get-navol | get-nasnapshot | where-object{$_.dependency -eq"busy,luns"}
But I would like to also report on the filer name and volume name along with the above two properties but these are not listed in the get-members of the nasnapshot.
Can anyone help how to displays these from I guess the get-navol properties?
cheers
Andy
Solved! See The Solution
Andy, I've just posted Toolkit 1.3. Please let me know whether it resolves your issue.
Hi, Andy. This should get you started:
PS C:\> Get-NaVol | % { $vol = $_.Name; Get-NaSnapshot $vol | Add-Member NoteProperty Volume $vol -PassThru } | Add-Member NoteProperty Controller $currentNaController.Name -PassThru | ? { $_.Dependency -LIKE "*busy*" } | ft Controller,Volume,Name,Dependency -Autosize
Controller Volume Name Dependency
---------- ------ ---- ----------
dunn vol1 clone_vol1clone.3 busy,vclone
dunn vol2 {1670257f-602b-4cf8-ac8a-b94e21486c95} busy,LUNs,vclone
dunn vol2 clone_vol2clone.2 busy,vclone
dunn vol2clone {1670257f-602b-4cf8-ac8a-b94e21486c95} busy,LUNs
thanks Clinton, it looks exactly what I need.
unfortunately I get the below error.
Get-NaVol : Value in $global:CurrentNaController is not of type NetApp.Ontapi.Filer.NaController
At line:1 char:10
+ Get-NaVol <<<< | % { $vol = $_.Name; Get-NaSnapshot $vol | Add-Member NoteProperty Volume $vol -PassThru } | Add-Member NoteProperty Controller $currentNaController.Name -PassThru | ? { $_.Depende
ncy -eq "busy,luns" } | ft Controller,Volume,Name,Dependency -Autosize
+ CategoryInfo : InvalidArgument: (:) [Get-NaVol], ArgumentException
+ FullyQualifiedErrorId : ControllerNotSpecified,DataONTAP.PowerShell.SDK.Cmdlets.Volume.GetNaVol
after this even a get-navol returns the same error, I have to reconnect to the controller again.
I have a look in the variables pre and post execution and it looks no different
Any ideas?
cheers
Andy
Hi, Andy. Sorry about that. There is nothing wrong with the example I posted, but it highlights a strange PowerShell behavior I recently ran across. In some cases the $currentNaController value gets wrapped by a PSVariable instance, which causes the Toolkit to throw the exception. A workaround for the issue is in the forthcoming Toolkit 1.3 release.
Andy, I've just posted Toolkit 1.3. Please let me know whether it resolves your issue.
Thanks Clinton. That indeed has fixed the issue.
Many thanks for all your efforts.
Cheers
Andy
How can we add related vfiler to the busy vclone?