Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


stevja01
2018-04-24T21:39:18Z
I'm using PowerShell for the 1st time on one of our servers which was just upgraded to VisualCron 8.3.4 and I'm getting the error below. One of the 1st things I noticed is that the error has two slashes (\\) beteween VisualCron and PowerShell when the actual path to the .exe is just ...VisualCron\PowerShell\.... but I'm not sure that's it. This is a simple script which just adds a HEADER to a TEXT file and I've checked all my paths, etc. and they are fine.

POWER SHELL SCRIPT:
## ADDS HEADER TO ATB FILE
## RENAMES FINAL FILE TO CT_OSA_MAGASIN_WHDR.TXT
$ATBFILE = 'F:\CLIENT\Attribution\AttributionStaging\AttributionInputFileStaging\CT_OSA_MAGASIN.TXT'
$HEADERFILE = 'F:\CLIENT\Attribution\AttributionStaging\AttributionInputFileStaging\MAGASIN_HEADER.txt'
$ATBFINALFILENAME = 'CT_OSA_MAGASIN_WHDR.txt'
$(Get-Content $HEADERFILE; Get-Content $ATBFILE) | Set-Content $ATBFILE
Rename-Item "$ATBFILE" "$ATBFINALFILENAME"

ERROR:
ExecuteProcess("D:\Program Files\ME\VisualCron\\PowerShell\TaskPowerShell.exe" 54)->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[] )
Sponsor
Forum information
ErikC
2018-04-25T05:22:39Z
Hi,

I tried this script, i only canged this line to a full path:
$ATBFINALFILENAME = 'F:\fullpath\CT_OSA_MAGASIN_WHDR.txt'

After that I saved the script in a file and I runned it. It went fine, no errors. I use now 8.2.9

Regards
Erik
Uses Visualcron since 2006.
stevja01
2018-04-25T13:35:33Z
Hi Erik,
I tried adding the full path but still getting errors below so it looks like some type of setup issue on our side potentially.

09:33:26: Server->Execute path: D:\Program Files\Nielsen\VisualCron\\PowerShell\TaskPowerShell.exe
09:33:26: Server->Executing Task process
09:33:27: Server->Sending Task information
09:33:27: Server->Task information sent
09:33:27: Server->Executing Task process exited with exit code: 0
09:33:27: Server->Waiting for completion and result
09:33:27: Server->Task result received, success: False

ExecuteProcess("D:\Program Files\CLIENT\VisualCron\\PowerShell\TaskPowerShell.exe" 61)->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-04-25T14:33:20Z
I think we found the issue. When I ran just PowerShell alone using get-executionpolicy its returning RESTRICTED whereas on my machine that does work this is UNRESTRICTED. So working with our INFRA people to update the registry and then we'll retry.
stevja01
2018-06-01T19:22:02Z
After a few weeks we have PowerShell running on our server. Below are lessons learned in case this helps anyone.

1. Ensure PowerShell's ExecutionPolicy = Unrestricted
Start Windows PowerShell and type in the command below at the prompt and hit enter. It should return unrestricted.
get-executionpolicy

If it returns restricted then enter the command below at the prompt and hit enter.
set-executionpolicy unrestricted

If you receive an Access Denied message, then open a ticket with your IT Team to update this for you. You may need to provide the steps below to them:
Update the Registry Editor (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell) with a tag for ExecutionPolicy and set it to Unrestricted

2. Sytem.TypeLoadException. If the ExecutionPolicy is setup correct and VisualCron returns the error below when running PowerShell, ask INFRA to upgrade PowerShell to the highest version available for the respective server. Recently we found that PowerShell v1 on a Windows 2008 SP2 servers will not execute PowerShell from VisualCron so we had to upgrade to PowerShell v2.

VisualCron Error:
ExecuteProcess("D:\Program Files\Client\VisualCron\\PowerShell\TaskPowerShell.exe" 170)->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 u11DNvPXLxNvv9G4GM.wBAAsNxLuDiC2tAocE.lUB3kwC66(String[] )
Support
2018-06-01T19:40:39Z
Originally Posted by: stevja01 

After a few weeks we have PowerShell running on our server. Below are lessons learned in case this helps anyone.

1. Ensure PowerShell's ExecutionPolicy = Unrestricted
Start Windows PowerShell and type in the command below at the prompt and hit enter. It should return unrestricted.
get-executionpolicy

If it returns restricted then enter the command below at the prompt and hit enter.
set-executionpolicy unrestricted

If you receive an Access Denied message, then open a ticket with your IT Team to update this for you. You may need to provide the steps below to them:
Update the Registry Editor (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell) with a tag for ExecutionPolicy and set it to Unrestricted

2. Sytem.TypeLoadException. If the ExecutionPolicy is setup correct and VisualCron returns the error below when running PowerShell, ask INFRA to upgrade PowerShell to the highest version available for the respective server. Recently we found that PowerShell v1 on a Windows 2008 SP2 servers will not execute PowerShell from VisualCron so we had to upgrade to PowerShell v2.

VisualCron Error:
ExecuteProcess("D:\Program Files\Client\VisualCron\\PowerShell\TaskPowerShell.exe" 170)->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 u11DNvPXLxNvv9G4GM.wBAAsNxLuDiC2tAocE.lUB3kwC66(String[] )



Thank you very much for the feedback!
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top