Hi folks --
I've been trying to use the visualcron powershell task to run a remote powershell session. The script is pretty straight forward -- create a remote powershell session on a web server, scrape the sites with appcmd and dump the output to a text file:
$ps=new-PSSession -computername j-random-webserver
invoke-command -session $ps -scriptblock {appcmd list site > c:\sites.txt}
remove-PSSession -session $ps
This script runs fine from the powershell prompt on any computer I've ever invoked it from. However, when I run it as a visualcron powershell task (either as an inline script or invoked from a script file) visualcron throws the following exception:
Exception in Task: Cannot validate argument on parameter 'Session'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
It looks like visualcron is not grokking the session object arg. I would appreciate any insight that anyone might have on this...
-Randy