I want to close leftover chrome windows which open with I have my UiPath workflow click Download.
I have a Powershell script called closechromeps.ps1 which contains one line:
stop-process -name “chrome” -force
I’m using an Invoke Powershell activity with the command text: “C:\UNFIRobot\UNFIRobot\closechromeps.ps1” and the ISScript checked.
When I run the UiPath process it fails saying
19.6.0+Branch.master.Sha.adf20656f41da84cdec5e5620b62276717eb7319
Source: Invoke Power Shell (Throw)
Message: File C:\UNFIRobot\UNFIRobot\closechromeps.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
Exception Type: System.Management.Automation.PSSecurityException
RemoteException wrapping System.Management.Automation.PSSecurityException: File C:\UNFIRobot\UNFIRobot\closechromeps.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. —> RemoteException wrapping System.UnauthorizedAccessException: File C:\UNFIRobot\UNFIRobot\closechromeps.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
--- End of inner exception stack trace ---
at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
But I have set the execution policy to unrestricted
PS C:\Windows\system32> get-executionpolicy -list
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Unrestricted
I can drop C:\UNFIRobot\UNFIRobot\closechromeps.ps1 into a powershell command window, hit enter, and it runs and closes chrome.
What am I doing wrong?
Any advice greatly appreciated! Thank you in advance.
Ravi