ONTAP Discussions

How to find if Volume Efficiency has been enabled using PowerShell Toolkit

Jim_Robertson
6,069 Views

I am trying to find all volumes on a cluster that do not have efficiencies enabled, but can't seem to get my syntax correct.  What am I missing?


Running the code below returns all the volumes that DO have SIS enabled on them:

$Vols = Get-NcVol
$Vols | Get-NcSis | Where-Object {($_.State)}


But, I can't seem to get it to return the volumes that do not have any SIS settings at all.  I've tried each of the following with the assumption that the property doesn't exist for any volumes that do not have SIS enabled:

$Vols | Get-NcSis | Where-Object {(!$_.State)}
$Vols | Get-NcSis | Where-Object {($_.State -eq $NULL)}
$Vols | Get-NcSis | Where-Object {($_.State -notcontains $NULL)}

All of them return nothing, even though there is at least one volume that does not have SIS enabled.

This is OnTap 9.5P3 and PSTK 4.7.

Thanks for any suggestions!

1 ACCEPTED SOLUTION

JGPSHNTAP
5,974 Views

There are many ways to skin this cat.

 

Here is the easiest which will print out each volume and you can sort from there

 

 

get-ncvol | Select Name,@{n='sisstatus';e={if (($_.volumesisattributes).issisvolume) {"enabled"} else {"disabled"}}} | ft -auto

View solution in original post

7 REPLIES 7

donny_lang
6,034 Views

Interesting - I tried many systems (9.3, 9.5, and 9.6) and multiple versions of the PSTK (as far back as 3.2 and 9.5, 9.6, and 9.7 as well) and was not able to find an instance where the "State" property did not contain a value on any of my volumes - if efficiency was enabled, the property was "enabled" and if disabled showed "disabled". 

 

"Get-NcSis" without any additional parameters should show you the efficiency settings on all of your volumes without needing to store the output of the "Get-NcVol" cmdlet in a variable as in your example (with the one caveat of displaying the path rather than just the volume name, I suppose).

 

When you run "Get-NcSis", do you still get properties with null values in your output? 

 

If you install a more recent version of the PSTK, are you able to replicate the issue? 

JGPSHNTAP
5,975 Views

There are many ways to skin this cat.

 

Here is the easiest which will print out each volume and you can sort from there

 

 

get-ncvol | Select Name,@{n='sisstatus';e={if (($_.volumesisattributes).issisvolume) {"enabled"} else {"disabled"}}} | ft -auto

Jim_Robertson
5,950 Views

Thanks, @JGPSHNTAP , that definitely seems to do the trick.  Sorry, should have looked at your response before responding.

That line of code does return a correct list of all the volumes and their sis status, I'm not clear on what exactly the code is doing.  If I look at that property of the object, it shows me either true or false.  Is your "If" statement just saying that if it's true return "enabled", otherwise return "disabled"?

Working with those "sub-properties" confuses me 🙂

JGPSHNTAP
5,945 Views

I'm just using a if statement on the boolean to create a more user friendly approach.

 

And i'm using Select statements to create a customized object

Jim_Robertson
5,928 Views

Ok, @JGPSHNTAP  so I think I'm almost there:

Get-NcVol | Select-Object Name,@{Name='IsSisVolume';Expression={$_.VolumeSisAttributes.IsSisVolume}}


Gives me the volume with a True/False for whether they are enabled or disabled.
So, I tried this:

Get-NcVol | Select-Object Name,@{Name='IsSisVolume';Expression={$_.VolumeSisAttributes.IsSisVolume}} | Where-Object {($_.IsSisVolume -eq "False")}

But it's returning the volumes DO have SIS enabled (IsSisVolume = True).  
But, if I try this:

Get-NcVol | Select-Object Name,@{Name='IsSisVolume';Expression={$_.VolumeSisAttributes.IsSisVolume}} | Where-Object {($_.IsSisVolume -ne "False")}

It returns all the volumes where SIS is disabled.  It reacts the same if I have true or false after the operator, so it seems to only care about what the operator is, not what is following it.  That makes no sense to me.  My PS-Fu is weak.  🙂

JGPSHNTAP
5,917 Views

Unless you need to pipe it to another script, you can easily add | epcsv c:\temp\sisvols.csv -notypeinformation and then open it and filter or just print out like you did with where-object 

 

LIke this

PS H:\powershell> get-ncvol | Select Name,@{n='sisstatus';e={if (($_.volumesisattributes).issisvolume) {"enabled"} else {"disabled"}}} | ? {$_.sisstatus -eq "enabled"}

Jim_Robertson
5,951 Views

@donny_lang, this happens for volumes that do not have SIS enabled, so I want to identify these volumes as well.  From the CLI, you can find these volumes using this command:

vol show -volume !*root*,!vol0 -is-sis-volume false


So, I think I may have partially answered my own question.  I think I actually need to run a different command to look for volumes that do not have SIS enabled.  For PowerShell, it seems like this parameter is what I want to look for:

$Vol.VolumeSisAttributes.IsSisStateEnabled

I would think that this would work, but it doesn't.  Why?

$Vols | Where-Object {($_.VolumeSisAttributes.IsSisEnabled -eq "false")}




Public