tjames192/PSCUC

Are there known issues running against CUC 12.5?

Closed this issue · 21 comments

I have been using your scripts for a year or more on CUC 11.5

We were just upgraded to 12.5 and now I am met with:

The remote server returned an error: (400) Bad Request.

This arises in Set-CUCMailboxPIN at the $Response = Invoke-RestMethod @irmSplat

My initial question is anyone running this successfully against 12.5?

The only thing that changed (other than version) that I had to accommodate in code was that our alias in 11.5 was only the username. Whereas in 12.5, our alias is now full email address. I wouldnt think the addition of the @ in the string would be breaking it.

howdy, to be honest I have no idea we are still using Cisco Unity v 12.0.1.
Do you have any additional details in the verbose output?
It's possible the URIs may have changed with upgrade I've tried to keep the URIs API agnostic but you never know until after..
I'll see if I can get 12.5 in trial and poke around or maybe Cisco was a nice enough to publish details on API.

after checking the api it appears nothing really changed for user password pin
https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/connection/REST-API/CUPI_API/b_CUPI-API/b_CUPI-API_chapter_01001.html

cisco also doesn't say there is any hard requirements for allowing or not allowing special characters in searching and sorting query
https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/connection/REST-API/CUPI_API/b_CUPI-API/b_CUPI-API_chapter_01001.html

I would test your query in browser to ensure that the url is formatted correctly and you get a proper response back from the server, you may need to ensure that @ symbol is encoded as %40
https://stackoverflow.com/questions/19509028/can-i-use-an-at-symbol-inside-urls/19737890

http:///vmrest/users?query=(alias%20startswith%20example)

http:///vmrest/users?query=(alias%20is%20example%40domain.com)

any chance you could provide a complete properly encoded URI i can check in browser? i am half-assed developer. more a systems guy. so it isnt my strongest suit.

I tried using postman and got denied because i hadnt submitted credentials and that led me on a long path of trying to figure out how to use that.

Try, replace server with yours and replace word example and domain with yours
http://server/users?query=(alias%20is%20example%40domain.com)

that works. my bad for no catching it too. i just saw it and them came back here and saw you fixed it.

Great, since we have known working uri what do you get in powershell?
Get-CUCUser example@domain.com

$URI = "https://$($session['server'])/vmrest/users?query=(alias is user%40domain.com)"
$user = Invoke-RestMethod -Headers $session['headers'] -Uri $URI

if put a stop point and check value of $user I get $user = @{@ToTal=0}

so even though that string works in browser. its not working in code.

im sure your aware of your code well enough, but that is from Process in Set-CUCMailboxPIN.ps1

Great, since we have known working uri what do you get in powershell? Get-CUCUser example@domain.com

I dont have the modules loaded in my profile to run like that. i will have to build a test script. give me a few.

$URI = "https://$($session['server'])/vmrest/users?query=(alias is user%40domain.com)" $user = Invoke-RestMethod -Headers $session['headers'] -Uri $URI
Weird does it work if you hardcode @ vs %40?

if put a stop point and check value of $user I get $user = @{@ToTal=0}

so even though that string works in browser. its not working in code.

im sure your aware of your code well enough, but that is from Process in Set-CUCMailboxPIN.ps1

get-cucuser is successful.

results @{URI=/vmrest/users/d3fbbe76-a2b3-494a-94e3-9c5e749395d4; ObjectId=d3fbbe76-a2b3-494a-94e3-9c5e749395d4;

it is returning the user successfully. i didnt include the rest of the debug output.

i could do a webex screenshare with you if your were so inclined.

For this uri /vmrest/users/d3fbbe76-a2b3-494a-94e3-9c5e749395d4 do you have an attribute UserVoicePinURI

For this uri /vmrest/users/d3fbbe76-a2b3-494a-94e3-9c5e749395d4 do you have an attribute UserVoicePinURI

how would i check? are you asking if they have a PIN set?

i see it....yes they do.

/vmrest/users/d3fbbe76-a2b3-494a-94e3-9c5e749395d4/credential/pin

i could do a webex screenshare with you if your were so inclined.

Sure let me get ready to leave for the office and we can connect in ~1hr

For this uri /vmrest/users/d3fbbe76-a2b3-494a-94e3-9c5e749395d4 do you have an attribute UserVoicePinURI

how would i check? are you asking if they have a PIN set?

i see it....yes they do.

/vmrest/users/d3fbbe76-a2b3-494a-94e3-9c5e749395d4/credential/pin

Ok test the Set-CUCUMMailboxPIN I don’t see a reason at this stage why it should not work and use the verbose parameter -verbose

Ok test the Set-CUCUMMailboxPIN I don’t see a reason at this stage why it should not work and use the verbose parameter -verbose

I have done this. still getting:

The remote server returned an error: (400) Bad Request.

was trying to find a way to direct message you my webex details. is that possible?

was trying to find a way to direct message you my webex details. is that possible?

Open this link for my email
https://privnote.com/mmlKytfA#Avo85nFTd

So....old server had no check for trivial password. new server had check for trivial password. I had a trivial password in my code.

error message was OBVIOUSLY not telling of this. Thanks to tjames for getting on a webex and stepping thru the code with me....and ultimately reminding me to RTFM.

its people like you that make this field manageable and enjoyable!!!

thanks again!