Categories: PowerCLI

NTP Conflagration with Power CLI

Check NTP Services status 

Get-VMHost | Get-VmHostService | Where-Object {$_.key -eq “ntpd”}

 

 

 

 

 

 

 

 

Check Firewall exception configuration 

Get-VMHost | Get-VMHostFirewallException | where {$_.Name -eq “NTP client”}

 

 

 

 

 

 

 

Enable the FirewallException to all ESXi Hosts

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

Disable the FirewallException to all ESXi Hosts

Get-VMHost | Get-VMHostFirewallException | where {$_.Name -eq “NTP client”} |Set-VMHostFirewallException -Enabled:$false

Start the NTP service on all ESXi nodes

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

Stop the NTP service on all ESXi nodes

Get-VMHost | Get-VmHostService | Where-Object {$_.key -eq “ntpd”} | Stop-VMHostService   ( use  ” -Confirm:$false to avaoid the the popoup quetion abut confimration )

 

 

 

 

 

 

 

Add the NTP servers to all ESXI Hosts

Get-VMHost | Add-VMHostNtpServer 192.168.1.1o,192.168.1.11

 

 

 

 

Verify NTP servers added  by running below command

Get-vmhost esx1.test.com |Get-VMHostNtpServer

 

 

 

 

Remove the NTP servers from ESXi Hots 

Get-vmhost esx1.test.com |Remove-VMHostNtpServer 192.168.1.10,192,168,1,11  -confirm:$false

 

 

 

Check the NTP Policy Configured 

Get-VMhost | Get-VmHostService | Where-Object {$_.key -eq “ntpd”}

 

 

 

 

 

 

Configure the  NTP Policy 

 

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

Note:– Get-VMhost “ESXIHOSTNAME” , if you use this you can apply these setting only to that HOST

             It is recommended to set the time manually prior to starting the service.

Rajesh Radhakrishnan

Share
Published by
Rajesh Radhakrishnan

Recent Posts

NAKIVO Backup & Replication v10.8 Released With New Features

Nakivo has released its new Backup and Replication solution Nakivo v10.8, which includes support for…

2 years ago

Oracle Cloud VMware Solution and Features

Oracle Cloud VMware Solution (OCVS) provides a customer-managed, native VMware-based cloud environment hosted in Oracle…

2 years ago

Vinchin Backup and Recovery Review

Vinchin is a professional provider of data protection solutions for enterprises. It provides a series…

2 years ago

VMware Cloud Disaster Recovery (VCDR) Solution Deployment And Configuration Part 2

In my previous blog post, I have explained about VMware Cloud Disaster Recovery (VCDR) Onboarding and…

2 years ago

How to Deploy vRNI Cloud With VMC on AWS

vRealize Network Insight helps you build an optimized, highly available, and secure network infrastructure across…

2 years ago

This SysAdmin Day, WIN with Hornetsecurity!

Can you believe it's here again? SysAdmin Day is back, and with it comes endless gratitude…

2 years ago