Unable to run PowerShell script through MID server
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2025 11:29 AM
I have a flow that needs to trigger a PowerShell scrip to run from the MID server (add an AD user to an AD group). I can see the output entry in the ecc_queue and it is getting processed, but the input side says:
<?xml version="1.0" encoding="UTF-8"?><parameters><parameter name="skip_sensor" value="true"/><parameter name="MIDScriptFile" value="scripts\\PowerShell\\PSAutomation\\UpdateAdUserGroupMembership"/><parameter name="powershell_param_samAccountName" value="[ "jdoe" ]"/>
<parameter name="powershell_param_groupName" value="Group Name"/><parameter name="powershell_param_request" value="req00123124"/><parameter name="powershell_param_identity" value="jdoe@domain.tld"/><parameter name="powershell_param_variable_1" value=""/></parameters>
I tried both UpdateAdUserGroupMembership and UpdateAdUserGroupMembership.ps1 and used both single and boule backslashes in the path.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 03:21 AM
Can you try adding file extension?
value="scripts\\PowerShell\\PSAutomation\\UpdateAdUserGroupMembership.ps1"
if it still does not work, check the logs file for that particular timestamp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 04:07 AM
Hi @Mike Hashemi
The Below Thread Work :-
https://www.servicenow.com/community/developer-forum/executing-powershell-command-on-mid-server/m-p/...
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/