Hello All,
I would like some assistance with a powershell script I am writing using swisPowershell to add volume to a node.
I have already successfully added a new node, a new interface, custom settings for the node, and also I was able to add virtual memory, physical memory, and a fixed disk drive to the node. Here is my dilemma. When I search the server; I see the local C drive listed, but when I go directly into that node and select "List Resources", the Volumes\Local C:\ Drive is unchecked in this list. I am not sure why it's unchecked even though it's visible for the node.


I saw a similar thread here: https://thwack.solarwinds.com/product-forums/the-orion-platform/f/orion-sdk/46117/add-volume-via-sdk
That basically is the same thing I am running into as the user in that thread, but I don't understand what his final fix was for that.
Here is a sample of my code.
Everything executes properly without any errors, but as I mentioned when I look at the link "List Resources" under the server node --> The Volume Utilization setting "C:\ Label" is listed and unchecked. The other 2 volume Utilization options I created for Physical Memory and Virtual memory are listed and checked as they should be.
$Drives = Get-CimInstance -ComputerName $node -ClassName Win32_LogicalDisk -Property * | Where-Object { $_.VolumeSerialNumber -ne $NULL }
foreach ($Drive in $Drives)
{
$VolumeIndex = 3
$PhysicalDrive = @{
NodeID = $nodeProps["NodeID"]
VolumeType = "Fixed Disk"
DeviceId = $Drive.DeviceID
VolumeTypeID = "4"
Icon = "FixedDisk.gif"
NextRediscovery = [DateTime]::UtcNow
VolumeIndex = [Int]$VolumeIndex
Caption = $Drive.DeviceID + "\ Label: " + $Drive.VolumeName + $Drive.VolumeSerialNumber
VolumeDescription = $Drive.DeviceID + "\ Label: " + $Drive.VolumeName + "Serial Number " + $Drive.VolumeSerialNumber
FullName = $Drive.PSComputerName + "-" + $Drive.DeviceID + "\ Label: " + $Drive.VolumeName + $Drive.VolumeSerialNumber
PollInterval="120"
StatCollection="15"
RediscoveryInterval="30"
#DiskQueueLength = ""
#DiskTransfer = ""
#DiskReads = ""
#DiskWrites = ""
#TotalDiskIOPS = ""
#VolumeSize = $Drive.Size
#VolumeSpaceAvailable = $Drive.FreeSpace
#VolumeSpaceUsed = ""
#VolumePercentUsed = ""
}
$PhysicalDriveURI = New-swisobject $swis -EntityType "Orion.volumes" -properties $PhysicalDrive
$PhysicalDriveProps = Get-SwisObject $swis -uri $PhysicalDriveURI
$PhysicalDrivePoller = @{
NetObject = "V:" + $PhysicalDriveProps["VolumeID"]
NetObjectType = "V"
NetObjectID = $PhysicalDriveProps["VolumeID"]
};
$PhysicalDrivePoller["PollerType"] = "V.Details.WMI.Windows";
$PhysicalDriveURI = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $PhysicalDrivePoller
$PhysicalDrivePoller["PollerType"] = "V.Statistics.WMI.Windows";
$PhysicalDriveURI = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $PhysicalDrivePoller
$PhysicalDrivePoller["PollerType"] = "V.Status.WMI.Windows";
$PhysicalDriveURI = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $PhysicalDrivePoller
Invoke-SwisVerb $Swis "Orion.Nodes" PollNow @("V:" + $PhysicalDriveProps["VolumeID"])
$VolumeIndex = $VolumeIndex + 1
}
----
On a side note, on the same List Resources screen, at the bottom there is an option for Asset Inventory. Is there a way to enable this feature? In my screenshot above you can see the highlighted area, From what I've read (not sure if it's related to this setting), but it seems to be buggy, but I just wanted to confirm since many of those threads were a few years old now.
Thank you in advance!