Last active
August 17, 2016 18:48
-
-
Save joasch/d38dd56e382bd0f457157ac75634a5c3 to your computer and use it in GitHub Desktop.
Abfragefunktion für NTP, Auswertung der deutschen w32tm Ausgabe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ibjs.net 20160817 Abfragefunktion für NTP, Auswertung der deutschen w32tm Ausgabe | |
$NTP_Server=@("ptbtime1.ptb.de", "ptbtime2.ptb.de", "ptbtime3.ptb.de", ` | |
"pool.ntp.org","europe.pool.ntp.org","de.pool.ntp.org ",` | |
"time-a.nist.gov","time-b.nist.gov ") | |
Function Get-NtpTime{ | |
Param($Server) | |
If (! $Server){$Server="ptbtime1.ptb.de"} | |
$NTPResponse={(iex "w32tm /stripchart /computer:$Server /dataonly /samples:0")[2]} | |
$NTPTime={get-date([regex]::Replace("$(&$NTPResponse)","([\D\s]+)([\d\. :]+)\.",'$2'))} | |
&$NTPTime | |
} | |
$NTP_Server|%{"{0,-20}{1}" -f $_,(Get-NtpTime $_)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment