I'm working on a script to connect to the Cisco Unity Connection API via PowerShell to reset a user's VM pin. I can get the ObjectID just fine but for whatever reason I can't get it to work to reset the VM pin.
$Username = ''
$Password = ''
$PIN = '1234'
$EncodedAuthorization = [System.Text.Encoding]::UTF8.GetBytes($Username + ':' + $Password)
$EncodedPassword = [System.Convert]::ToBase64String($EncodedAuthorization)
$Headers = @{
Authorization = "BASIC $($EncodedPassword)"
Accept = 'application/json'
}
$r = Invoke-RestMethod -Uri 'https://IP/vmrest/users/?query=(alias is ALIAS)' -Headers $Headers
$objectid = $r.User.ObjectId
$response = Invoke-RestMethod 'https://IP/vmrest/users/OBJECTID/credential/pin
' -Method 'Put' -Headers $headers
$response
I've also tried:
$response = Invoke-RestMethod 'https://IP/vmrest/users/OBJECTID/credential/pin?PIN=1234' -Method 'PUT' -Headers $headers
I'd appreciate any guidance here.
TIA