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


Randy
  •  Randy
  • No customer Topic Starter
2013-06-26T14:13:37Z
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
Sponsor
Forum information
Support
2013-06-26T14:17:11Z
Can you simplify this even more so we can do a test here (without any special dependencies).
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Randy
  •  Randy
  • No customer Topic Starter
2013-06-26T14:51:18Z
Originally Posted by: Support 

Can you simplify this even more so we can do a test here (without any special dependencies).



I think I can. In the powershell task, you will need to open a pssession on one of the computers on your network and then close it. The following two lines of powershell code should be enough to replicate the error. Replace "remote" with the name of a computer on your network.

$ps=new-PSSession -computername remote
remove-PSSession -session $ps


-Randy
Support
2013-06-27T07:41:26Z
I am no expert at PowerShell but it sounds like a permission problem. The reason you get the error is because the Session could not be created for some reason.

What if you test the following:

1. stop the VisualCron service
2. go to the VisualCron installation folder
3. double click on the VisualCronService.exe
4. wait 30 seconds and then connect with the Client again
5. now run the Task again - do you get the same problem?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top