I'm reading in a CSV file where a column contains information that allows me to match a row to Orion.Nodes.SysName. Using a PS script modified by Chad.Every, I am attempting to modify node properties using that SysName value as the key. However, I am getting an error I don't fully understand the cause.
"Invoke-WebRequest : {"Message":"Invalid key properties specified for entity Orion.Nodes.\u000d\u000aParameter"
Within SWQL this works fine
Select n.NodeID, n.DisplayName, n.SysName, n.Caption, n.StatusLED, n.DetailsUrl, n.Location, cp.device_location
From Orion.Nodes n
INNER JOIN Orion.NodesCustomProperties cp ON cp.NodeID = n.NodeID
WHERE n.SysName = 'myName'
Without posting all of the script, the meat is thus:
$sysname=$args[0]
$swisuri = "swis://$($hostname)/Orion/Orion.Nodes/SysName=$($sysname)/CustomProperties"
$url = "https://$($hostname):17778/SolarWinds/InformationService/v3/Json/$swisuri"
$var = "test"
$json = @{"DEVICE_LOCATION"="$var"}
$json = ConvertTo-Json $json
Using NodeID works fine though.
Additionally, before deciding I needed to create the CustomProperty, I tried the same with the same result to update the Location property
$sysname=$args[0]
$swisuri = "swis://$($hostname)/Orion/Orion.Nodes/SysName=$($sysname)/Nodes"
$url = "https://$($hostname):17778/SolarWinds/InformationService/v3/Json/$swisuri"
# There is a Node Custom Property in Orion called 'SendAlert'
$var="test location"
$json = @{"Location"="$var"}
$json = ConvertTo-Json $json
Question on this, if I successfully change the Location property, is that made to the device so that it is persistent or will it be overwritten at the net device poll?