Hi all,
I am fairly new to using PowerCLI, but have already seen the benefits of using it to help manage and administer a large infrastructure, we have about 50 hosts using esx4i, and it has been very useful. I have a problem though in trying to run a health check, I want to create a batch file that calls a .ps1 script and then schedule it as a task... However, here is the batch file code :
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -command "&{c:\scripts\myscript.ps1}"
it comes up with this in the cmd prompt after running the batch file :
Please specify a VI Server name eg....
powershell.exe vCheck.ps1 MyvCenter
However I have the Connect-Viserver connection code in the myscript.ps1 ... The script runs great from PowerCLI , does anyone know what I am missing ? Thanks for your help....any input would be appreciated.
chris
I'm not much of a PowerCLI person, but you don't have to create a batch file. Just paste the line of text below into your Windows OS scheduled task. We usually set the run as: with an account with rights to vCenter. Also, make sure the box to run only if logged in is unchecked.
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -command "&{c:\scripts\myscript.ps1}"
I'm not much of a PowerCLI person, but you don't have to create a batch file. Just paste the line of text below into your Windows OS scheduled task. We usually set the run as: with an account with rights to vCenter. Also, make sure the box to run only if logged in is unchecked.
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -command "&{c:\scripts\myscript.ps1}"