$accessId = '##IP2DNS.ACCESSID##'
$accessKey = '##IP2DNS.KEY##'
$company = 'uclahealth'
$deviceID = '##SYSTEM.DEVICEID##'
$currentName = '##SYSTEM.HOSTNAME##'
$currentDisplayName = '##SYSTEM.DISPLAYNAME##'
if ($currentName -ne $currentDisplayName) {
# do a patch here to update the Name
# you need to patch to
# 'https://uclahealth.logicmonitor.com/santaba/rest/device/devices/$($deviceID)?patchFields=displayName'
# and the payload of your HTTP request needs to have something like the following JSON:
# {"displayName":"$currentName"}
#Request Info
$httpVerb = 'PATCH'
$resourcePath = '/device/devices/128'
$queryParams = '?patchFields=displayName'
$data = '{"displayName":"$currentName"}'
Send-Request $resourcePath $httpVerb $queryParams $data
Write-Host "ip2dns.result=Changed IP $($currentName) to DNS $($currentDisplayName)"
} else {
Write-Host "ip2dns.result=Did not change IP to DNS"
}
this is the current script, I think I am missing something ...
BTW when doing "test script" in the PropertySource does it write the machine used during the test?
Thanks,
Dom
|