Software Development Kit (SDK) and API Discussions
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.
$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.
See The Solution
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.
View solution in original post
Join our Discord Community