How to call a remote powershell script from within a ARS workflow?

Hi all, 

Using ARS 7.4.3. I have a rather long Powershell script which I would like to start from a workflow. Meaning the workflow starts an Active Roles Powershell script which then fires the external script. In a normal powershell command windows, I woud just type:

PS C:\> .\scripts\test.ps1

This would then start the script. If I do the same within Active Roles I get an error saying: 

Execution of workflow instance failed.
Workflow name: *****_Azure - Step2_Migration
Workflow GUID: 3fc267ea-6de9-ea11-a300-00505697358f
Workflow instance GUID: e49ab746-b4d0-4a47-bd67-a426355e60a9
Operation ID: 1-20981
Operation GUID: 4db6e52c-f9b3-4018-8e9d-8534fbf28aeb
Operation: Modify Object
Object name: Test OnlineMigration2
Object parent container: ***********/_Prod/001/Users
Object type: user
Object GUID: e9b54881-fb4b-4357-a32d-9becd1907305
Initiator: *****\A0019000
Details:
At line: 37 char:5. The term 'C:\scripts\test.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

 

I have also tried Invoke-Expression $MyScript. Same error.

#Execute a script via Invoke-Expression
$MyScript = 'C:\Users\a0019000\Untitled46.ps1'
Invoke-Expression $MyScript

 I have seen multiple question and answers in regards to this in the forum but none of the suggestions seem to work for me.

Any ideas how this should be done??

 

Regards

Andy

Parents Reply Children
No Data