Powershell script failing on Production
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 06:45 AM
Hello ALL,
I am working on one automation that we placed poweshell script on MID server and calling from catalog and build using flow designer .
I had completed on dev instance and got the correct output and then moved to Prod. Now Prod , automation is failing getting error saying " Sub flow error" with below logs.
Can anyone please help me to fix or At least give me some suggestions where to find and what type of error this is.
thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 07:19 AM
Hi @ack
I've been working with PowerShell and Orchestration for years now, dealing with all types of situation, I didn't face the one you did, but I can suggest few things (if is not done yet).
In all your PowerShell scripts, would be good to add this line at the end of them:
$Error | %{$This = $_; Write-Host $This.invocationInfo.scriptlinenumber $This.Exception.Message}
This will capture any failure in the PS script and show in the output with the line number that failed.
You can also grab the MID Server logs and dig deeper in it to find more information as well, if any.
You should also confirm the credentials being used in PRD has the appropriate permissions to run the PowerShell script.
If I remember anything else I'll put here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 07:37 AM
Thank you for quick response.
I forgot to mention that The PowerShell script is working and giving the output when we run it from the MID sever standalone and while running from catalog , it giving the above error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 08:09 AM - edited 04-02-2025 08:35 AM
Oh, ok.
In your DEV environment, did it work from the Flow or by testing the script directly in the MID server?
Make sure your PRD MID Server has the appropriate capabilities enabled.
Make sure also the checkbox Use Attachment is checked in your PS script file in the instance, also ensure all variables needed by the script is being passed in Flow.
The example below is from one of the flows we have that uses PS scripts.
EDIT: For this, we created an Action that is called from the Flow, you need to pass all PS variables needed in the Flow and the Action.
Feel free to provide screenshot of your settings, just make sure to not show any company info.