Subscribe

PowerShell Tool Kit case sensitivity issue

[ Edited ]

I'm using the latest version of the PSTK and I'm writing some scripts to check the status of SnapVault relationships and ran into an interesting issue with case sensitivity. When I run the cmdlet, Get-NaSnapvault, it returns the secondary path in all lowercase. It just so happens that there are capital letters in the volume name which contains the qtree, so if I try to parse the text or even run the Get-NaQtree cmdlet using the SecondaryPath property of the objects returned by Get-NaSnapvault, I get nothing:

 

 

PS H:\> Get-NaSnapvault | Format-Table -AutoSize

PrimarySystem PrimaryPath             SecondaryPath                                                   MaxRate MaxTries
------------- -----------             -------------                                                   ------- --------
ahnfas8978    /vol/test_snapvault_wfa /vol/test_snapvault_wfa_mirror_2016_06_v1/qtree_02062016_153641    4 TB        2
ahnfas8978    /vol/test_snapvault_wfa /vol/test_snapvault_wfa_mirror/qtree_02062016_153641               4 TB        2



PS H:\> Get-NaQtree /vol/test_snapvault_wfa_mirror_2016_06_v1/qtree_02062016_153641 | Format-Table -AutoSize

PS H:\> 

 

But if I correct the volume name, it works fine:

 

PS H:\> Get-NaQtree /vol/test_snapvault_wfa_mirror_2016_06_V1/qtree_02062016_153641 | Format-Table -AutoSize

Volume                               Qtree                 Status Security OpLocks
------                               -----                 ------ -------- -------
test_snapvault_wfa_mirror_2016_06_V1 qtree_02062016_153641 normal unix     enabled



PS H:\> 

I can correct this by using PowerShell to do a case insensitive match, but that's a little messy and shouldn't be necessary. If ONTAP is case sensitive anywhere, it should be case sensitive everywhere.

 

 

Re: PowerShell Tool Kit case sensitivity issue

Use get-nasnapvaultsecstatus - see if that's different.

 

I'm on v3.3 build 65

Re: PowerShell Tool Kit case sensitivity issue

It also returns in all lowercase:

 

PS H:\> Get-NaSnapvaultSecStatus | ft -AutoSize

Primary                                Secondary                                                                  State       Status   LagTimeTS
-------                                ---------                                                                  -----       ------   ---------
ahnfas8978:/vol/test_snapvault_wfa     ahnfas8978:/vol/test_snapvault_wfa_mirror/qtree_02062016_153641            snapvaulted idle      08:29:33
ahnfas8978:/vol/vol01_fl3677_cifs01_DR ahnfas8966:/vol/vault_current/vault_vol01_fl3677_cifs01                    source      idle   54.08:59:36
ahnfas8978:/vol/test_snapvault_wfa     ahnfas8978:/vol/test_snapvault_wfa_mirror_2016_06_v1/qtree_02062016_153641 source      idle   10.22:10:05

Re: PowerShell Tool Kit case sensitivity issue

Hi,

 

I really think this is not a powershell issue. Windows usually doesn't care about case but Ontap does. Since powershell make use of ONTAPI (Ontap API) it does really care about it.

 

To help you with this I have a little trick. First get snapvault result to a variable then extract volume name in lowercase. After that you can do somethink like this:

 

$RightCasedVolumeName = (Get-NaVol|Where-Object{$_.Name -imatch $lowerCaseVolumeName}).Name

It's a little bit uggly (actually it's horrible) but works.

 

You can use ZEDI Explorer to check API output just to be sure if this is an API issue.

Re: PowerShell Tool Kit case sensitivity issue

Yes, that's basically what I'm doing with my code. It would be much better if the toolkit returned everything in the proper case to begin with.

Re: PowerShell Tool Kit case sensitivity issue

Hello@jgebhart2,

 

I really think this is not related to Powershell Toolkit. I've tried in my environment and i get response in correct case.

 

To be sure, you can download netapp-manageability-sdk (not the .net bindings one) and go to the folder zedi. Inside there is the an executable called zexplore.exe. From there you can query your filer. This cmdlet uses the "snapvault-secondary-configuration-list-info" API call.

 

If i had any filer in the same version you have and using snapvault in it I could try it.

Re: PowerShell Tool Kit case sensitivity issue

You're correct, the issue is not specifically with the PowerShell Toolkit - I get the same case mismatch using the CLI:

 

ahnfas8978> snapvault status
Snapvault is ON.
Source                                  Destination                                                                 State          Lag        Status
ahnfas8978:/vol/test_snapvault_wfa      ahnfas8978:/vol/test_snapvault_wfa_mirror/qtree_02062016_153641             Snapvaulted    685:57:25  Quiescing
ahnfas8978:/vol/vol01_fl3677_cifs01_DR  ahnfas8966:/vol/vault_current/vault_vol01_fl3677_cifs01                     Source         1982:27:28  Idle
ahnfas8978:/vol/test_snapvault_wfa      ahnfas8978:/vol/test_snapvault_wfa_mirror_2016_06_v1/qtree_02062016_153641  Source         939:37:57  Idle
ahnfas8978>

Either way, it's sloppy. Smiley Happy

Re: PowerShell Tool Kit case sensitivity issue

The only thing I can think of is to upgrade your Ontap version.