NTP configuration on multiple ESXi hosts via PowerCLI

As you might know, keeping our ESXi hosts’ date and time accurate is very critical. To prevent having an inaccurate time configuration we can use the NTP server in our environment.
A few days ago, I faced a question about NTP configuration in the vSphere environment and how to set NTP configuration on many ESXi hosts. Hence, I decided to use the PowerCLI commands to configure NTP configuration most easily with an example.

Kindly find the commands have been used in my example:

Connect-VIServer vCenter_Server_Address
Get-VMHost | Add-VMHostNtpServer ntp.virtual-mir.com
Get-VMHost | Get-VMHostFirewallException | where {$_.Name -eq “NTP client”} | Set-VMHostFirewallException -Enabled:$true
Get-VMHost | Get-VmHostService | Where-Object {$_.key -eq “ntpd”} | Start-VMHostService
Get-VMhost | Get-VmHostService | Where-Object {$_.key -eq “ntpd”} | Set-VMHostService -policy “automatic”

I’m sure if you are a GUI person, switching to PowerCLI might be a hard transition but once you used to script, you will never go back to GUI, and learning new things is always fun, so let’s try out.

You might be interested in …

How to check the compliance of VMware new Licensing for an enterprise

VMware

  As you might already know VMware announced a change to its per-CPU licensing model,effective April 2, 2020.   Do you want to check if you are compliant or need more licenses? Just see below VMwareKB which contains a PowerCLI script for checking this. VMware KB

Read More

How to find VDI Client (ThinClient) MAC address from Horizon View

Horizon View, VMware

        While administering VDI environments, most of the time we will struggle to get Thin Client or VDI Client MAC address for troubleshooting, re-imaging or for providing remote shadow support. Below article explains about a simple “visual basic” script to get this information. In my case, I kept this script on network […]

Read More

Configure App Volumes Manager

AppVolumes, VMware

In my previous post we installed the App Volumes Manager. Now it is time for it’s configuration. In this post I will show you the basic configuration to start of with App Volumes. Before we start make sure you have a Service Account ready for App Volumes. During the configuration, you will need this account to […]

Read More

Leave a Reply

Your email address will not be published. Required fields are marked *