Powershell script located on MID server does not run from powershell activity anymore

alexlwm
Giga Expert

Hi guys,

So we have an issue with running powershell scripts from the "Run Powershell" activity:

We have a workflow running to add permission for a user to access a shared mailbox in Office 365. This is done by running the below script in a "Run Powershell" activity in a workflow:

C:\SN_Scripts\365cred\Connect_LWM.ps1;

Add-MailboxPermission -Identity ${current.variables.email_access.u_string_2} -User ${current.u_requested_for.email} -InheritanceType All -AccessRights FullAccess -AutoMapping $true

Now since a week or so, we get an error message:

The term 'C:\SN_Scripts\365cred\Connect_LWM.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program.

The script has always worked before and we did not change anything that can impact the workflow, scripts or MID server.

Some additional information:

  • Powershell in added to the MID capabilities
  • Mid server is up and running
  • Restarting MID server does not help
  • The script is still there on the MID server and the user that runs the script has full permission to the folder and files.

Please help!

Thx, Alex

1 ACCEPTED SOLUTION

Hi Rhys,



I think i know what the problem is... We have 2 mid servers, and i think it is using the worng MID server sometimes. Resulting in the error.



I'll test it and let you know the results.



Thanks for the help, you helped me thinking in a different direction.


View solution in original post

4 REPLIES 4

rhysbrennan
Tera Expert

Any other scripts affected? Can you run manually as the service account?


Hi Rhys,



Thank you for the quick reply. When running the script in Windows powershell ISE on the MID server manually, it works. Other scripts are not affected, but this is the only script where we make use of using it in a powershell activity in this particular way.



BTW: I have restarted the workflow, and now it is working. So it's not failing all the time. Strange behaviour...



Thanks, Alex


That's odd. I know I had some issues at the start where the account had to open powershell.exe to configure but sounds like that's not the issue.



I'd try run the command rather than the file to confirm. It appears somewhere the file path is confused as the command. Some screen shots of the activity would be helpful until I'm at work tomorrow.


Hi Rhys,



I think i know what the problem is... We have 2 mid servers, and i think it is using the worng MID server sometimes. Resulting in the error.



I'll test it and let you know the results.



Thanks for the help, you helped me thinking in a different direction.