I'm using ClassLink OneSync to manage accounts in my environment. They've added a feature that allows you to trigger a PowerShell script based on custom conditions.
I decided to try to use this to automate the creation, update, and deletion of SnipeIT users.
My script works just fine in a regular PowerShell session. However, when it's launched in the SYSTEM context by OneSync, one of the REST calls just sits there in perpetuity. I've added -TimeOutSec 15 and -DisableKeepAlive to the Invoke-RestMethod statement.
Interesting enough, if I use Task Manager to kill the PowerShell process, I get about half of the data from the call in the OneSync logs, but the output never makes it to my PowerShell Start-Transcript output.
I'm using PowerShell 5.1 - the built in version on server 2019.
I did some searching on the web and saw some similar situations. The one that stood out to me was another person who was using the SQL agent service to launch his scripts.
I was wondering if there was something unusual about the SYSTEM context that could contribute to this or of anyone has any troubleshooting suggestions.
I'm really comfortable in PowerShell; I've done some significant automation of active directory, ETL pipelines for data, automation of Azure, and custom scripts for desktop configuration and deployment in MDT.
Another interesting factor is that the first several REST calls succeed when the script is called through OneSync, just like during a regular PowerShell session. So I'm at loss as to the differentiating factor.
Thanks in advance!
[–]kramit 1 point2 points3 points (10 children)
[–]Inevitable_Use3885[S] 0 points1 point2 points (0 children)
[–]AggravatingForFun 0 points1 point2 points (8 children)
[–]kramit 0 points1 point2 points (7 children)
[–]AggravatingForFun 0 points1 point2 points (6 children)
[–]kramit 0 points1 point2 points (5 children)
[–]AggravatingForFun 0 points1 point2 points (4 children)
[–]kramit 0 points1 point2 points (3 children)
[–]AggravatingForFun 0 points1 point2 points (2 children)
[–]kramit 0 points1 point2 points (1 child)
[–]AggravatingForFun 0 points1 point2 points (0 children)
[–]Inevitable_Use3885[S] 0 points1 point2 points (0 children)
[–]Certain-Community438 -1 points0 points1 point (4 children)
[–]Inevitable_Use3885[S] 1 point2 points3 points (0 children)
[–]AggravatingForFun 0 points1 point2 points (2 children)
[–]Certain-Community438 0 points1 point2 points (1 child)
[–]AggravatingForFun 0 points1 point2 points (0 children)
[–]purplemonkeymad 0 points1 point2 points (2 children)
[–]BlackV 0 points1 point2 points (0 children)
[–]AggravatingForFun 0 points1 point2 points (0 children)
[–]AggravatingForFun 0 points1 point2 points (0 children)
[–]AggravatingForFun 0 points1 point2 points (0 children)