By following below steps you can schedule PowerCLI scripts in Windows Task scheduler to execute at specific time.
Start Windows Task Scheduler.
Click on Create Task
In The General Menu, Enter Task name “Any Task Name”
In Security Options, Select a User Account by which this scripts will get executed.
Select “Run whether user is logged on or not”
Click on Triggers Menu
Click On New
Select the Schedule when you want to execute PowerCLI script and reboot esxi Host.
Click on Actions Menu
Click on New
in New Action Window, Select Action as Start a Program
Under Settings Program/Scripts, Enter PowerShell.exe path
In Add arguments (optional) Filed enter PowerCLI plugin path and script name.
-PSConsoleFile "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" " & C:\temp\RebootESXiHost.ps1
Make sure you keep the quotes as above.
Click on OK.
Click on OK to Close Create Task menu.
if Prompted enter password of user account by which this script will get executed.
This will execute PowerCLI script as scheduled.