RAJ_RAJ
Expert
Expert

Hi  ,

use these commands

Check and COnfigure NTP on all ESXI hosts


> Get-VMHost | Get-VmHostService | Where-Object {$_.key -eq "ntpd"}


Key       Label         Policy     Running  Required

---       -----         ------     -------  --------

ntpd     NTP Daemon       on         True     False

ntpd     NTP Daemon       on         True     False

ntpd     NTP Daemon       off        False    False

ntpd     NTP Daemon       off        False    False



> Get-VMHost | Get-VMHostFirewallException | where {$_.Name -eq "NTP client"}


Name         Enabled  OutgoingPorts  Protocols  ServiceRunning

----         -------  -------------  ---------  --------------

NTP Client   True        123            UDP        True

NTP Client   True        123            UDP        True

NTP Client   False       123            UDP        False

NTP Client   False       123            UDP        False

NTP Client   False       123            UDP        False




>Get-VMHost | Add-VMHostNtpServer 192.168.1.1



> Get-VMHost | Get-VMHostFirewallException | where {$_.Name -eq "NTP client"} |Set-VMHostFirewallException -Enabled:$true


Name                 Enabled  OutgoingPorts  Protocols  ServiceRunning

----                 -------  -------------  ---------  --------------

NTP Client           True      123            UDP        True

NTP Client           True      123            UDP        True

NTP Client           True      123            UDP        False

NTP Client           True      123            UDP        False




> Get-VMHost | Get-VmHostService | Where-Object {$_.key -eq "ntpd"} | Start-VMHostService


Key    Label         Policy     Running  Required

---    -----         ------     -------  --------

ntpd  NTP Daemon     on         True     False

ntpd  NTP Daemon     on         True     False

ntpd  NTP Daemon     off        True     False

ntpd  NTP Daemon     off        True     False


> Get-VMhost | Get-VmHostService | Where-Object {$_.key -eq "ntpd"} | Set-VMHostService -policy "automatic"


Key    Label         Policy     Running  Required

---    -----         ------     -------  --------

ntpd   NTP Daemon   automatic  True     False

ntpd   NTP Daemon   automatic  True     False

ntpd   NTP Daemon   automatic  True     False


Note:- Get-VMhost  "ESXIHOSTNAME"  , if you use this you can apply these setting only to that HOST .

visit for more :-  vSphere Advanced Technics: Work With vSphere Power CLI

RAJESH RADHAKRISHNAN VCA -DCV/WM/Cloud,VCP 5 - DCV/DT/CLOUD, ,VCP6-DCV, EMCISA,EMCSA,MCTS,MCPS,BCFA https://ae.linkedin.com/in/rajesh-radhakrishnan-76269335 Mark my post as "helpful" or "correct" if I've helped resolve or answered your query!