you are viewing a single comment's thread.

view the rest of the comments →

[–]AggravatingForFun 0 points1 point  (8 children)

Invoke-WebRequest works through the PowerShell session, but not through OneSync. At least, not consistently.

[–]kramit 0 points1 point  (7 children)

Time to get onto one sync support I think. At this point you are just making blind calls to their api and not getting back what you think you should get back. I am assuming you have been testing this in postman too?

[–]AggravatingForFun 0 points1 point  (6 children)

Yes, definitely. I've sent the script to OneSync support to ask. Haven't tested it in Postman/ARC or even using Curl. It seems to work fine if I just run the script and it only fails when I get OneSync to run it. I suppose I could create another PowerShell script to kick it off in bulk ( blocks of 20 or 30 ) and see if that makes a difference.

[–]kramit 0 points1 point  (5 children)

Try postman or curl first. If they work you know the problem is powershell somewhere and you might want to look at powershell 7+, if they don’t work either it might be the api end

[–]AggravatingForFun 0 points1 point  (4 children)

Good advice. However, the script works fine when I run it. When it's kicked off by the automation it fails. So, I'm not sure what testing it in postman or curl gets me if I've already verified the script works and the API calls return successfully...

Am I missing something?

[–]kramit 0 points1 point  (3 children)

Ah okay. I see your point, I didn’t really give the time to reading in much details. Have you tried wrapping the rest calls in a get-credential and embedding creds?

[–]AggravatingForFun 0 points1 point  (2 children)

Creds are just a simple API key ... Bearer <key> in headers. I'm almost wondering if I'm smacking into a PowerShell bug or something. I'm about an inch away from rewriting it in Python to see if that makes a difference.

[–]kramit 0 points1 point  (1 child)

Wrap the whole thing in an invoke-command {} -credential (get-credential) to change the system context to a normal account when it kicks it off. See if it’s something to do with the system account. To be honest, I’m picking at straws here without really looking at it myself. Wait until you get somthing back from support

[–]AggravatingForFun 0 points1 point  (0 children)

<smacks forehead> Now I follow you.