ONTAP Discussions

Highlighted

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

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!

7 REPLIES 7
Highlighted

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

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? 

Highlighted

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

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

Highlighted

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

@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")}




Highlighted

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

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 🙂

Highlighted

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

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

Highlighted

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

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.  🙂

Highlighted

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

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"}

Check out the KB!
Knowledge Base
All Community Forums