Unable to run PowerShell script through MID server

Mike Hashemi
Kilo Sage

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:

 

Unable to find script(s) specified in parameters. Make sure the script(s) associated with probe are passed down properly.
 
When I RDP to the MID server, I can see that the .ps1 file was created as expected (and contains the script).
 
This is what I'm sending in the output queue:
<?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.

2 REPLIES 2

jominjohncy
Tera Contributor

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.

Ravi Gaurav
Giga Sage
Giga Sage

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/