This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Modify Volume Custom Property

I want to be able to Modify the value of a Volume Custom Property but can not seem to find the correct SWIS VERB syntax.

# Get the Node information I need

$NODE = Get-SwisData $swis "SELECT NodeID,Caption,SysName,DNS FROM Orion.Nodes WHERE DNS=@DNSFQDN" @{ DNSFQDN = $DNSFQDN }

$NODEID = $NODE.NodeID

#Using the NodeID QUery the volume to get the Custom Property and Everything else to check it works.

$OrionResponses = Get-SwisData $swis "SELECT Volumes.CustomProperties.BitLocker_Enabled, [AncestorDetailsUrls],[AncestorDisplayNames],[Caption],[Description],[DetailsUrl],[DetailsUrl],[DeviceId],[DiskQueueLength],[DiskReads],[DiskSerialNumber],[DiskTransfer],[DiskWrites],[DisplayName],[DisplayName],[FullName],[Icon],[Image],[Index],[InstanceSiteId],[InstanceType],[InterfaceType],[LastSync],[MinutesSinceLastSync],[NextPoll],[NextRediscovery],[NodeID],[OrionIdColumn],[OrionIdPrefix],[PollInterval],[RediscoveryInterval],[Responding],[SCSIControllerId],[SCSILunId],[SCSIPortId],[SCSIPortOffset],[SCSITargetId],[Size],[SkippedPollingCycles],[StatCollection],[Status],[Status],[StatusDescription],[StatusIcon],[StatusIconHint],[StatusLED],[StatusLED],[TotalDiskIOPS],[Type],[UnManaged],[UnManageFrom],[UnManageUntil],[Uri],[VolumeAllocationFailuresThisHour],[VolumeAllocationFailuresToday],[VolumeDescription],[VolumeID],[VolumeIndex],[VolumePercentAvailable],[VolumePercentUsed],[VolumeResponding],[VolumeSize],[VolumeSpaceAvailable],[VolumeSpaceAvailableExp],[VolumeSpaceUsed],[VolumeType],[VolumeTypeIcon],[VolumeTypeID]

FROM Orion.Volumes WHERE NodeID=@nodeis AND DeviceID=@deviceIs" @{ nodeis = $NodeID; deviceIs = $DeviceID }

# Uncomment the line below for troubleshooting and to see what is returned

#$OrionResponses

# Construct the modify array elements

$propertyname = "Bitlocker_Enabled"

Invoke-SwisVerb $swis Orion.Volumes.CustomProperties ModifyCustomProperty @($propertyName,'true')

The result of running the script and this particular section is:

BitLocker_Enabled                : True                                                                                                                                    

AncestorDetailsUrls              : {/Orion/NetPerfMon/VolumeDetails.aspx?NetObject=V:6238, /Orion/NetPerfMon/NodeDetails.aspx?NetObject=N:2897}                            

AncestorDisplayNames             : {E:\ Label:SWINstalls 4C3B9FA0, MON-NETMON2}                                                                                            

Caption                          : E:\ Label:SWINstalls 4C3B9FA0                                                                                                           

Description                      : Fixed Disk                                                                                                                              

DetailsUrl                       : /Orion/NetPerfMon/VolumeDetails.aspx?NetObject=V:6238                                                                                   

DetailsUrl1                      : /Orion/NetPerfMon/VolumeDetails.aspx?NetObject=V:6238                                                                                   

DeviceId                         : E:                                                                                                                                      

DiskQueueLength                  : 0                                                                                                                                       

DiskReads                        : 0                                                                                                                                       

DiskSerialNumber                 :                                                                                                                                         

DiskTransfer                     : 0                                                                                                                                       

DiskWrites                       : 0                                                                                                                                       

DisplayName                      : E:\ Label:SWINstalls 4C3B9FA0                                                                                                           

DisplayName1                     : E:\ Label:SWINstalls 4C3B9FA0                                                                                                           

FullName                         : MON-NETMON2-E:\ Label:SWINstalls 4C3B9FA0                                                                                               

Icon                             : FixedDisk.gif                                                                                                                           

Image                            :                                                                                                                                         

Index                            : 7                                                                                                                                       

InstanceSiteId                   : 0                                                                                                                                       

InstanceType                     : Orion.Volumes                                                                                                                           

InterfaceType                    :                                                                                                                                         

LastSync                         : 3/2/2018 21:53:16                                                                                                                       

MinutesSinceLastSync             : 0                                                                                                                                       

NextPoll                         : 3/2/2018 21:55:07                                                                                                                       

NextRediscovery                  : 3/2/2018 21:53:44                                                                                                                       

NodeID                           : 2897                                                                                                                                    

OrionIdColumn                    : VolumeID                                                                                                                                

OrionIdPrefix                    : V:                                                                                                                                      

PollInterval                     : 120                                                                                                                                     

RediscoveryInterval              : 30                                                                                                                                      

Responding                       : Y                                                                                                                                       

SCSIControllerId                 :                                                                                                                                         

SCSILunId                        :                                                                                                                                         

SCSIPortId                       :                                                                                                                                         

SCSIPortOffset                   :                                                                                                                                         

SCSITargetId                     :                                                                                                                                         

Size                             : 42946523136                                                                                                                             

SkippedPollingCycles             : 0                                                                                                                                       

StatCollection                   : 15                                                                                                                                      

Status                           : 1                                                                                                                                       

Status1                          : 1                                                                                                                                       

StatusDescription                : Up                                                                                                                                      

StatusIcon                       : Up.gif                                                                                                                                  

StatusIconHint                   :                                                                                                                                         

StatusLED                        : Up.gif                                                                                                                                  

StatusLED1                       : Up.gif                                                                                                                                  

TotalDiskIOPS                    : 0                                                                                                                                       

Type                             : Fixed Disk                                                                                                                              

UnManaged                        : False                                                                                                                                   

UnManageFrom                     :                                                                                                                                         

UnManageUntil                    :                                                                                                                                         

Uri                              : swis://MON-NetMon.stanleygroup.com/Orion/Orion.Nodes/NodeID=2897/Volumes/VolumeID=6238                                                  

VolumeAllocationFailuresThisHour : 0                                                                                                                                       

VolumeAllocationFailuresToday    : 0                                                                                                                                       

VolumeDescription                : E:\ Label:SWINstalls  Serial Number 4C3B9FA0                                                                                            

VolumeID                         : 6238                                                                                                                                    

VolumeIndex                      : 7                                                                                                                                       

VolumePercentAvailable           : 76.92691                                                                                                                                

VolumePercentUsed                : 23.07309                                                                                                                                

VolumeResponding                 : Y                                                                                                                                       

VolumeSize                       : 42946523136                                                                                                                             

VolumeSpaceAvailable             : 33037434880                                                                                                                             

VolumeSpaceAvailableExp          : 33037434880                                                                                                                             

VolumeSpaceUsed                  : 9909088256                                                                                                                              

VolumeType                       : Fixed Disk                                                                                                                              

VolumeTypeIcon                   : FixedDisk.gif                                                                                                                           

VolumeTypeID                     : 4                                                                                                                                       

                                                                                                                                                                           

Invoke-SwisVerb : Verb Orion.Volumes.CustomProperties.ModifyCustomProperty: Not found                                                                                      

At C:\Users\8304\Documents\SAPIEN\PowerShell Studio\Files\Bitlocker-SAM.ps1:115 char:3                                                                                     

+         Invoke-SwisVerb $swis Orion.Volumes.CustomProperties ModifyCu ...                                                                                                

+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                    

    + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1                                                                                    

    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb             

I tried mimicking the syntax examples for modifying the node custom properties using the Volumes. But is obviously not working. Any insights into the correct syntax would be appreciated.                                                                                        

  • Hey tomiannelli! The SDK is divided into two parts - regular CRUD operations and then verbs. What you're looking for is an update operation against the volume's custom property. Give me a few minutes and I'll cook up an example for you.

  • Here you go. I created the Bitlocker_Enabled custom property in my environment to test. This goes through and sets the first 10 volumes (ordered by VolumeID) to true if they aren't already.

    Import-Module SwisPowerShell

    $hostname = "localhost"
    $swis = Connect-Swis -Hostname $hostname -Trusted

    # get the first 10 volumes from the Orion.Volumes entity along with its current
    # custom property setting by joining to the Orion.VolumesCustomProperties
    # entity via the VolumeID field in both
    $query = @"
        SELECT TOP 10
            v.VolumeID
            ,v.URI AS VolumeURI
            ,v.Caption AS VolumeName
            ,vcp.Bitlocker_Enabled
        FROM Orion.Volumes v
        JOIN Orion.VolumesCustomProperties vcp ON v.VolumeID = vcp.VolumeID
        ORDER BY v.VolumeID
    "@

    $volumes = Get-SwisData -SwisConnection $swis -Query $query

    # for each volume, determine if the value is already set to true and set
    # only if it's isn't already
    foreach ($v in $volumes) {
        if ($v.Bitlocker_Enabled -eq "true") {
            continue
        }

        Write-Host "Setting volume [$($v.VolumeName)] property BitLocker_Enabled to true..."
        Set-SwisObject -SwisConnection $swis -Uri ("{0}/CustomProperties" -f $v.VolumeURI) @{ Bitlocker_Enabled = "true" }
    }
  • Hi

    as Steven says, the main trick here is to find the URI of that volume(s). You can either find the URI from the Orion.Volumes table and then append /CustomProperties at the end of the URI, or get the complete URI from the Orion.Volumes.CustomProperties table. Either way will give you the URI that you need in order to edit the value of the custom property.

    Raul Gonzalez

    Prosperon - UK SolarWinds Partners

    Installation | Consultancy | Training | Licenses

    facebook_icon.jpglinkedin.pngblogger.pngtwitter-icon.jpg

  • Thank you sir. I see what you did by using the Set-SwisObject to perform the CRUD operation. That looks easier than using the SwisVerb, since I already have the URI for the volumes of interest. I will put that into my script and let you know how it goes. The ultimate goal is to have SolarWInds Monitor the volumes and update the custom properties automatically. Because what we also want to check for will be BitLocker AutoUnlock and alert when they are not set the way we expect.