I run it on Windows 2012 server and it works fine. Looking at your script, add the following line to first line of your script:
Add-PSSnapin VMware.VimAutomation.Core
For the Action, I use:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
And argument:
-PSConsoleFile "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -command "&{C:\scheduled\report.ps1}"
Let me know if it doesn't work.
How do you start this script in the task management? Maybe Re: Export CSV doesn't update the file when it runs via Task Scheduler will help.
André
Do you run the scheduled task under the same account as the one with which you tested the run manually ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I run it on Windows 2012 server and it works fine. Looking at your script, add the following line to first line of your script:
Add-PSSnapin VMware.VimAutomation.Core
For the Action, I use:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
And argument:
-PSConsoleFile "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -command "&{C:\scheduled\report.ps1}"
Let me know if it doesn't work.
I totally blew that one! That's usually the first thing I do and I missed it when I went to shedule the task.
Thank you