What is the difference between running this command:
Invoke-Command -ComputerName $computername -Credential $username -ScriptBlock { PowerShell $scriptPath $param1 $param2 }
and running a scheduled task that runs the same script with the same parameters, same user (Option "Run whether user is logged on or not")?
My script opens Excel which loads some data, calculates with matlab and then saves. Everything works fine when the script runs via task scheduler. However, when I do this directly (without task scheduler), Excel just hangs. As far as I was able to debug, it just hangs (runs in the background doing nothing) when the Activeworkbook.Refreshall command is supposed to execute.
What am I missing?
Thanks in advance! :)