VirtuallyNotHer
Contributor
Contributor

This script is great, I am just having no luck getting it to run as a scheduled task on Windows 2008 R2.  I tried to run the script from a command prompt, then within powershell, and no luck as I keep getting an error about the 'operand' and it appears to be caused by the -command portion.

I saved the snapshot deletion script to a .ps1 file

Then I setup a scheduled task and entered in the command that was in one of the replies to this thread, then I tried to edit it, searched quite a while and no luck.

Any ideas what's missing?

Here is the command I was using and I am thinking that it's a syntax error with " marks or something else, but I am not finding it..I tried putting the spaces in for the "C:\Program Files (x86) and that didn't work, and I tried taking out the -command portion.

%systemroot%\system32\windowspowershell\powershell.exe\v1.0\powershell.exe PSConsoleFile "C:\Program Files(x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -command "&{C:\Program Files(x86)\VMware\Infrastructure\vSphere PowerCLI\ps\DelSnaps.ps1}"

Reply
0 Kudos