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


MRomer
2019-08-12T18:11:01Z
I'm using a PowerShell task to execute a script stored on disk. The exact location of the script file is specified and the Working Folder is set to the script's location. lt The script completes and gives me the output it is supposed to, but VC shows this in the error log each time I run the task:
Quote:

Cannot bind argument to parameter 'Path' because it is null.
Exception in Task: Cannot bind argument to parameter 'Path' because it is null.


Any idea what I'm getting wrong?
Sponsor
Forum information
Support
2019-08-13T10:04:00Z
Originally Posted by: MRomer 

I'm using a PowerShell task to execute a script stored on disk. The exact location of the script file is specified and the Working Folder is set to the script's location. lt The script completes and gives me the output it is supposed to, but VC shows this in the error log each time I run the task:

Quote:

Cannot bind argument to parameter 'Path' because it is null.
Exception in Task: Cannot bind argument to parameter 'Path' because it is null.


Any idea what I'm getting wrong?



Like Joey S pointed out, could be something like that? It's something in your script that is the cause of this, not within VisualCron. Try to debug it within your script.
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
MRomer
2019-08-13T14:46:56Z
Originally Posted by: Support 

Like Joey S pointed out, could be something like that? It's something in your script that is the cause of this, not within VisualCron. Try to debug it within your script.


The script in question does not invoke anything on a remote computer, and the script completes all of it's tasks as expected. It does not throw an error outside of the VisualCron PowerShell task. I do not get the error when running it manually, so I have nothing to debug.

I tried creating an Execute task that ran C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe, passing the script and its parameters with the -File argument. It still worked fine, and this time no error appeared in VisualCron.
Support
2019-08-13T14:55:13Z
Originally Posted by: MRomer 

Originally Posted by: Support 

Like Joey S pointed out, could be something like that? It's something in your script that is the cause of this, not within VisualCron. Try to debug it within your script.


The script in question does not invoke anything on a remote computer, and the script completes all of it's tasks as expected. It does not throw an error outside of the VisualCron PowerShell task. I do not get the error when running it manually, so I have nothing to debug.

I tried creating an Execute task that ran C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe, passing the script and its parameters with the -File argument. It still worked fine, and this time no error appeared in VisualCron.



Can you export the task and send the script to support@visualcron.com so we can take a look and see if we can reproduce this?
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
MRomer
2019-08-13T18:13:15Z
Originally Posted by: Support 

Can you export the task and send the script to support@visualcron.com so we can take a look and see if we can reproduce this?


Done. Thanks.
Support
2019-08-14T07:13:13Z
Most likely the problem is this line:

Split-Path $script:MyInvocation.MyCommand.Path | Set-location 


This seems like a property that works in a shell cmd window. We do not use the shell for execution as we use the PowerShell host for execution (no cmd window is involved). I suggest you pass this as a parameter.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
MRomer
2019-08-14T15:30:22Z
Originally Posted by: Support 

Most likely the problem is this line:

Split-Path $script:MyInvocation.MyCommand.Path | Set-location 


This seems like a property that works in a shell cmd window. We do not use the shell for execution as we use the PowerShell host for execution (no cmd window is involved). I suggest you pass this as a parameter.


That was it. I removed that line and the errors have stopped. Thank you.
Scroll to Top