VMware Cloud Community
PUNTOREAR
Contributor
Contributor
Jump to solution

Powercli to set NTP service startup policy

pastedImage_0.png

I have script to set ntp servers on my esxi hosts:

Get-VMHost | Add-VMHostNtpServer -NtpServer ntpserver1
#This set of commands is aprt of our standard build process.

#Configure NTP server
Add-VmHostNtpServer -NtpServer ntpservers1 -VMHost $VMHosts

#Allow NTP queries outbound through the firewall
Get-VMHostFirewallException -VMHost $VMHosts | where {$_.Name -eq "NTP client"} | Set-VMHostFirewallException -Enabled:$true

#Start NTP client service and set to automatic
Get-VmHostService -VMHost $VMHosts | Where-Object {$_.key -eq "ntpd"} | Start-VMHostService
Get-VmHostService -VMHost $VMHosts | Where-Object {$_.key -eq "ntpd"} | Set-VMHostService -policy "automatic"

But how do I use powercli to set the startup policy to start with host ?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

On the Policy parameter you can use 3 values.

  • automatic: start and stop with port usage
  • on: start and stop with host
  • off: start and stop manually


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

On the Policy parameter you can use 3 values.

  • automatic: start and stop with port usage
  • on: start and stop with host
  • off: start and stop manually


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos