VMware Cloud Community
Hemijimi
Contributor
Contributor
Jump to solution

Blank .CSV only when ran as a sheduled task.

I have a script that I am trying to run in Windows 2012 R2 Task Scheduler. The script runs fine manually, but as a scheduled task the .csv file comes up empty. Has anybody ran into this before? .

Reply
0 Kudos
1 Solution

Accepted Solutions
ssbkang
Enthusiast
Enthusiast
Jump to solution

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.

View solution in original post

Reply
0 Kudos
4 Replies
a_p_
Leadership
Leadership
Jump to solution

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é

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
ssbkang
Enthusiast
Enthusiast
Jump to solution

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.

Reply
0 Kudos
Hemijimi
Contributor
Contributor
Jump to solution

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

Reply
0 Kudos