I went and disabled that API token. You should delete it and generate a new one.
I created two properties on VRPSCCMRS01: ip2dns.accessid and ip2dns.key, containing a new API token id and key. Your script should use ##IP2DNS.ACCESSID## ##IP2DNS.KEY## to pull those values into the script at runtime.
Your script should take on a form something like this:
$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"}
Write-Host "ip2dns.result=Changed IP $($currentName) to DNS $($currentDisplayName)"
} else {
Write-Host "ip2dns.result=Did not change IP to DNS"
}
I'm not a Powershell guy, so while I can follow what your script is trying to do, I can't really help you write the function to do it.