Using the following Script, I did a cleanup of my volumes inventory:
$swis = Connect-Swis -trusted -Hostname 127.0.0.1 #To forward current logged in username/password to server
$volumes = Get-SwisData $swis "SELECT v.NodeID, n.Caption as NodeCaption, n.MachineType, n.SysObjectId, v.VolumeID, v.Index as VolumeIndex, v.Caption as VolumeCaption, v.Type, v.FullName as VolumeFullName, v.Uri
FROM Orion.Volumes v LEFT JOIN Orion.Nodes n
ON n.NodeID = v.NodeID
WHERE n.SysObjectID LIKE '1.3.6.1.4.1.2636.%' AND v.Caption NOT LIKE '%/da0s%'"
write-host "List of all volumes to delete: $volumes"
$totalvolumes = $volumes.Count
$volumes | Format-Table
Write-Host ""
Write-Host "[INFO] There are $totalvolumes matching the criterias"
IF ($totalvolumes -eq 0) {
write-host "[INFO} No volumes matching your search criteria! You are all set!"}
ELSE {
$title = 'Confirmation Needed'
$question = "Do you want to proceed with the removal of $totalvolumes volumes?"
$choices = New-Object Collections.ObjectModel.Collection[Management.Automation.Host.ChoiceDescription]
$choices.Add((New-Object Management.Automation.Host.ChoiceDescription -ArgumentList '&Yes'))
$choices.Add((New-Object Management.Automation.Host.ChoiceDescription -ArgumentList '&No way Jose!'))
$decision = $Host.UI.PromptForChoice($title, $question, $choices, 1)
IF ($decision -eq 0) {
Write-Host "[INFO] Attempting removal of $totalvolumes volumes"
foreach ($volume in $volumes) {
Remove-SwisObject $swis $Volume.Uri
}
} else {
Write-Host '[INFO] Cancelled by user'
}
}
My goal is to remove non-needed volumes from my Juniper switches and router, as it cannot be done automagically using the Network Discovery process.
Once applied, indeed, volumes are not monitored anymore:

My problem is that the Node status is not updated:

in Manage Nodes, there are no grayed out volumes to delete, it is as expected:

I tried the rediscovery with no luck...
Any input you can provide is appreciated!