alanrenouf / vCheck-vSphere

vCheck Daily Report for vSphere
MIT License
732 stars 326 forks source link

vCheck for Vmware scheduling with task scheduler in windows 2016 #711

Open rachappachalmi opened 4 years ago

rachappachalmi commented 4 years ago

Hi Experts,

need your help....

I am able to run the vCheck script manually and i get the report but not able to schedule in windows scheduler, below are parameter I configured with task scheduler.

Action : Start a program Program/Script : C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe Add argument : ExecutionPolicy Bypass -File “E:\Rachappa\OMSR_A1_App\Test\vCheck-vSphere-master\vCheck.ps1"

Can somebody help me configure this vCheck with task scheduler or batch file ?

lucdekens commented 4 years ago

Since you also cross-posted this in the VMTN PowerCLI Community, I know the issue was primarily due to a lack of documentation.

I'll try to add this to the documentation for v7 and include an example.

selimatmaca commented 2 years ago

figure this vCheck with task scheduler or batch file ?

I have exact same problem.

selimatmaca commented 2 years ago

I solved the problem with a batch file. Here's what I have done: Created a batch file named "Start-vCheck.bat". In this file I have the following commands: cd "%~dp0" start powershell -noexit -Command "cd 'C:\vCheck'" start powerShell -NoExit -Command ".\vCheck.ps1"

In task scheduler: I used a service account (this user does not exists on vcenter, my vcenter is not ad integrated) Task runs with highest priviledge of course In Action Page: Program/Script: C:\vCheck\Start-vCheck.bat Start in (optional): C:\vCheck (it says optional but if I dont enter the path it does not work)

If someone needs, try the way I did, it works great.