Microsoft Virtualization Discussions

Get-NcEfficiency vs DataProtection SVM


Heelo PS Toolkit gurus,


My code (browed from here and modified to my purpose).


$DataVservers = Get-NcVserver | Where-Object {$_.VserverType -eq "data"}
ForEach ($Vserver in $DataVservers) {
Get-NcEfficiency -vserver $Vserver | 
Sort-Object vserver | Select-Object Vserver, Name, @{ 'N'="Cpacity"; "E"={ ConvertTo-FormattedNumber -Type DataSize -NumberFormatString "0.00" -Value $_.Capacity }}, @{ 'N'="Used"; "E"={ ConvertTo-FormattedNumber -Type DataSize -NumberFormatString "0.00" -Value $_.Used }}, @{ 'N'="Free"; "E"={ ConvertTo-FormattedNumber -Type DataSize -NumberFormatString "0.00" -Value $_.Free }} |format-table -Autosize


There is a dataprotection SVM on the cluster. Script displays ok until hit the DR-SVM. It throws this error and continue with the rest of the SVMs



Get-NcEfficiency : Object reference not set to an instance of an object.
At line:2 char:1
+ Get-NcEfficiency -vserver $Vserver |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ( [Get-NcEfficiency], NullReferenceException
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Toolkit.Efficiency.GetNcEfficiency


Any work around to supress this error and display the data for the DR-SVM also?





Hello @storageguy,


You'll want to add an additional filter to your query for the SVM sub-type...


Get-NcVserver -Query @{ VserverType = "data"; "VserverSubtype" = "default" }

There are four possible values for the sub-type:


  • default - normal SVMs
  • dp_destination - SVM-DR destination
  • sync_source - MetroCluster source SVM
  • sync_destination - MetroCluster destination SVM

Add/remove them from your query to get the type needed.


Hope that helps.



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


Unfortunatly, that didn't solve the issue. Error message still appearing and I still want my DR SVM volumes also included in the report. BTW: all my SVMs are data and subtype default (except node ones and admin one)


Thanks again looking into this.