Hi,
I wrote an powershell script that can set custom properties but I have a problem with setting the value for a custom property to 'NULL'.
Here my script:
$hostname = "HOSTNAME"
$username = "USERNAME"
$password = ConvertTo-SecureString -AsPlainText -Force -String 'PASSWORD'
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$NodeID = 2
$swisuri = "swis://$($hostname)/Orion/Orion.Nodes/NodeID=$($NodeID)/CustomProperties"
$url = "https://$($hostname):17778/SolarWinds/InformationService/v3/Json/$swisuri"
$json = @{
"customproperty1"='value1'
"customproperty2"=$null
}
$body = ConvertTo-Json $json
Invoke-WebRequest -Uri $url -Credential $cred -Method Post -Body $body -ContentType application/json
The content of $body (after converting to JSON) looks like this:
{
"customproperty1": "value1",
"customproperty2": null
}
So it looks like the content was correctly converted to JSON, but when i look in the database (for example via the SWQL-Studio) this field isn't 'NULL' it's empty (empty string).
'value1' for customproperty1 is set correctly.
How do I get it done that I can fill the field with 'NULL'?
Many greetigns