Software Development Kit (SDK) and API Discussions

E-series PowerShell Toolkit and Remove-NeVolume


I'm trying out the PowerShell Toolkit for the E-series arrays and I've hit a bit of a snag.


Up to this point, I got the WebServices Proxy running and I have managed to get basic connectivity going. 


My first script correlated all offline disks in Windows which were served from my E2712 and removed the mappings with Remove-NeVolumeMapping. This works fine.


My intended next step was to actually deleted all unmapped volumes, and this is where I've encountered an error.


Import-Module NetApp.SANtricity.PowerShell
$user = "rw"
$pwd = "rw"

$url1 = "http://localhost:8080/devmgr"

$cred = Get-NeProxyCredential -Url $url1 -ProxyUser $user -ProxyPwd $pwd

$storageSystems = Get-NeStorageSystem -Credential $cred

foreach ($storageSystem in $storageSystems)
 $volumes = Get-NeVolume -SystemId $storageSystem.Wwn
    $volumeMappings = Get-NeVolumeMappings -SystemId $storageSystem.Wwn
    foreach ($volume in $volumes)
        if ($volumeMappings.VolumeRef.Substring(8).IndexOf($volume.Wwn) -eq -1) # The volume is NOT mapped, ie the index is -1
            Remove-NeVolume -SystemId $storageSystem.Wwn -Id $volume.Wwn -Credential $cred

This errors out with:

Remove-NeVolume : Processing class 'devmgr.api.symbol.KeyValueTagMappingDeletionDescriptorList'
At C:\Users\Administrator\Documents\deleteUnmappedVolumes1.ps1:20 char:13
+             Remove-NeVolume -SystemId $storageSystem.Wwn -Id $volume.Wwn -Creden ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Remove-NeVolume], NetAppPowerShellException
    + FullyQualifiedErrorId : parameterError,Netapp.Santricity.PowerShell.RemoveVolumeCmdlet

Not much to go on. I'm certain my credentials and call of the storage system is correct, I use the same syntax in a previous script to remove mappings, and that works.




Replying to myself, I figured out my error.

Remove-NeVolume -SystemId $storageSystem.Wwn -Id $volume.Id -Credential $cred

Is the correct syntax. I was using $volume.wwn, in my first attempt, and when I changed it to above it works.

NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.