PowerShell Task Type Execution Error: Unhandled execution error:... - VisualCron - Forum

Community forum

stevja01
2018-05-02T18:38:50Z
We're on day 7 trying to get the PowerShell script task type to work after upgrading to 8.3.4. Initially we found that the executionPolicy was not set to Unrestricted. We corrected that and now I can run my script in a PS1 file from PowerShell but it will not execute from VisualCron.

The error is as per below. I did notice that the path to the TaskPowerShell.exe file is INCORRECT, it should be D:\Program Files\Client\VisualCron\PowerShell\TaskPowerShell.exe however I'm not sure where in the software the path to this exe is stored. Can anyone help and I can try fixing that to see if that resolves the issue?

ERROR:
ExecuteProcess("​​D:\Program Files\Client\VisualCron\\PowerShell\TaskPowerShell.exe" 82)->Unhandled execution error: System.TypeLoadException: Could not load type 'System.Management.Automation.Runspaces.WSManConnectionInfo' from assembly 'System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at TaskPowerShell.PowerShellTaskClass.Run(ProcessPowerShellTaskInfoClass ti, StringBuilder& sbStandardOut, StringBuilder& sbStandardError, Boolean& bolResult)
at dUtPYORi17ijmNNndt.ULQ6EH7NAE6DFp6YS7.nVBckLHfQ(String[] )
stevja01
2018-05-04T18:40:04Z
Support Team:
Our IT team sent me the note below today re this issue, is this correct and it's a bug so we'll have to just use the EXE with a PS1 file for now? Ugh :(

Looks like this is a bug in this version of VisualCron.
We had a similar issue in older versions of VC which was fixed in 7.5.x.x and I believe the same is happening on the new version.
This is the latest version installed on the server so it might take some time for VC to fix this one and until we get a fixed version from VC you can use the execute task and call the powershell script through VC.
Support
2018-05-07T08:40:59Z
Originally Posted by: stevja01 

Support Team:
Our IT team sent me the note below today re this issue, is this correct and it's a bug so we'll have to just use the EXE with a PS1 file for now? Ugh :(

Looks like this is a bug in this version of VisualCron.
We had a similar issue in older versions of VC which was fixed in 7.5.x.x and I believe the same is happening on the new version.
This is the latest version installed on the server so it might take some time for VC to fix this one and until we get a fixed version from VC you can use the execute task and call the powershell script through VC.



How is the path incorrect? Where did you install VisualCron?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
stevja01
2018-05-08T13:07:45Z

Software is located here:
D:\Program Files\CLIENT\VisualCron\PowerShell\TaskPowerShell.exe

ERROR:
ExecuteProcess("D:\Program Files\CLIENT\VisualCron\\PowerShell\TaskPowerShell.exe" 99)->Unhandled execution error: System.TypeLoadException: Could not load type 'System.Management.Automation.Runspaces.WSManConnectionInfo' from assembly 'System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at TaskPowerShell.PowerShellTaskClass.Run(ProcessPowerShellTaskInfoClass ti, StringBuilder& sbStandardOut, StringBuilder& sbStandardError, Boolean& bolResult)
at dUtPYORi17ijmNNndt.ULQ6EH7NAE6DFp6YS7.nVBckLHfQ(String[] )
Support
2018-05-08T13:32:08Z
Strange, what if you copy that from the VisualCron base folder to sub folder PowerShell?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
stevja01
2018-05-08T13:34:26Z
Did you notice though that it had two slashes between VisualCron and Powershell in the ERROR vs. the actual path?
I wonder if that's causing it? Though I have no idea in VisualCron where you change the path to the PowerShellTask.exe file......thoughts?
Support
2018-05-08T15:55:15Z
Originally Posted by: stevja01 

Did you notice though that it had two slashes between VisualCron and Powershell in the ERROR vs. the actual path?
I wonder if that's causing it? Though I have no idea in VisualCron where you change the path to the PowerShellTask.exe file......thoughts?



The two slashes is not a problem. Did you try to copy the dll to the folder?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
stevja01
2018-05-08T15:59:56Z
Support
2018-05-08T16:14:57Z
Originally Posted by: stevja01 

Which .dll?



The one in the error: System.Management.Automation.dll
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
stevja01
2018-05-08T17:01:53Z
No luck, same error:
I copied the System.Management.Automation.dll file to the folder: D:\Program Files\CLIENT\VisualCron\PowerShell

ERROR:
ExecuteProcess("D:\Program Files\CLIENT\VisualCron\\PowerShell\TaskPowerShell.exe" 113)->Unhandled execution error: System.TypeLoadException: Could not load type 'System.Management.Automation.Runspaces.WSManConnectionInfo' from assembly 'System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at TaskPowerShell.PowerShellTaskClass.Run(ProcessPowerShellTaskInfoClass ti, StringBuilder& sbStandardOut, StringBuilder& sbStandardError, Boolean& bolResult)
at dUtPYORi17ijmNNndt.ULQ6EH7NAE6DFp6YS7.nVBckLHfQ(String[] )
Support
2018-05-08T19:47:42Z
I see now what the reason might be related to. Someone must have uninstalled or made changes to PowerShell on this machine. Using default settings on a Windows machine should not be a problem. We are referring to PowerShell 1.0 and this seems to have changed somehow on the computer you have VisualCron on.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
stevja01
2018-05-08T20:09:06Z
So we will not be able to use PowerShell on this machine?
Support
2018-05-09T12:41:07Z
Originally Posted by: stevja01 

So we will not be able to use PowerShell on this machine?



Yes, but you might want to compare settings and re-install PowerShell 1.0.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
stevja01
2018-05-09T13:26:39Z
I'll ask our INFRA team to uninstall and reinstall and see if that might fix it then. I'll keep you posted on how that goes.
stevja01
2018-05-10T15:20:41Z
Hi Henrik,
So we've uninstalled PowerShell and reinstalled and confirmed the version is 1.0.0.0, same error.
Then we tried uninstalling VisualCron and reinstalling, same error.
Any ideas what we can try next?
Scroll to Top