Configure NTP & Syslog

The below script allows you to quickly configure the NTP & Syslog settings on all hosts in a specified cluster. It will prompt you to enter an NTP server & Syslog server address before applying it to each host. Im using my usual variables:
$Global:DCChoice – DC Choice
$Global:CLUChoice – Cluster Choice

function VP-SetNTPandSyslog
{
$NTPServer = Read-Host " Please Enter NTP Server details"
$SyslogServer = Read-Host " Please Enter Syslog Server details"
Get-datacenter $Global:DCChoice | Get-Cluster $Global:CLUChoice | get-vmhost | Add-VMHostNtpServer -NtpServer $NTPServer
Get-datacenter $Global:DCChoice | Get-Cluster $Global:CLUChoice | Get-VMHost | Set-VMHostSysLogServer -SysLogServer "$SyslogServer"
Get-datacenter $global:DCChoice | Get-Cluster $global:CLUChoice | get-vmhost | Select Name, @{N=“NTP Server“;E={$_ | get-vmhostNtpserver}}, @{N=“Syslog Server“;E={$_ | get-vmhostsyslogserver}}
Write-Host -NoNewLine 'Complete. Press any key to continue…';
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
}

Loading

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.