Hey all,
I am looking for a script that would check the NTP services status on vHosts and if possible print out what time the vHost thinks it is. Then on top of that print out what the vHosts has for the DNS server settings?
So what I am looking for:
NTP Service Status Time DNS Server Setting
Let me know if this is possible, thanks!
Oops, forgot that one.
Try like this
Get-VMHost | Select Name,
@{N='NTP Service Running';E={Get-VMHostService -VMHost $_ | where{$_.Key -eq 'ntpd'} | select -ExpandProperty Running}},
@{N='DNS Server(s)';E={$_.Extensiondata.Config.Network.DnsConfig.Address -join ' | '}},
@{N='Time';E={(Get-View -Id $_.ExtensionData.ConfigManager.DatetimeSystem).QueryDateTime()}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this
Get-VMHost | Select Name,
@{N='NTP Service Running';E={Get-VMHostService -VMHost $_ | where{$_.Key -eq 'ntpd'} | select -ExpandProperty Running}},
@{N='DNS Server(s)';E={$_.Extensiondata.Config.Network.DnsConfig.Address -join ' | '}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That worked for the most part but did not report the time itself.
Oops, forgot that one.
Try like this
Get-VMHost | Select Name,
@{N='NTP Service Running';E={Get-VMHostService -VMHost $_ | where{$_.Key -eq 'ntpd'} | select -ExpandProperty Running}},
@{N='DNS Server(s)';E={$_.Extensiondata.Config.Network.DnsConfig.Address -join ' | '}},
@{N='Time';E={(Get-View -Id $_.ExtensionData.ConfigManager.DatetimeSystem).QueryDateTime()}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello Lucd,
I have seen your other posts for creating a scheduled task to generate , need help on creating a scheduled task.
And the one below is reporting the status of NTP service but i need alarms generated if in case the ntp service is stopped.
Is there any way that can be done?
Get-VMHost | Select Name,
@{N='NTP Service Running';E={Get-VMHostService -VMHost $_ | where{$_.Key -eq 'ntpd'} | select -ExpandProperty Running}}
Thanks,
vikram M
Afaik, there is no event fired when an ESXi service is stopped or started.
The only way to have this implemented would be to run a script in the background (scheduled), that checks the status of the service.
And warns you when the service is not running (by email for example)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference