Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FITS.NetUtils

PSGallery Version PSGallery Downloads PowerShell 5.1+ License: MIT

Network utility functions for PowerShell — starting with a full RFC 5905 NTP client that returns rich diagnostic output including stratum, delay, dispersion, and clock offset.

Netzwerk-Hilfsfunktionen für PowerShell — beginnend mit einem vollständigen RFC-5905-NTP-Client, der umfangreiche Diagnoseinformationen zurückgibt: Stratum, Delay, Dispersion und Uhr-Offset.


Installation

Install-Module -Name FITS.NetUtils

Functions / Funktionen

Get-NtpTime

Queries one or more NTP servers and returns a rich diagnostic object per server — or a plain DateTime value when used with -AsDateTime.
Fragt einen oder mehrere NTP-Server ab und gibt ein umfangreiches Diagnoseobjekt pro Server zurück — oder einen einfachen DateTime-Wert mit -AsDateTime.

# Full diagnostic output
Get-NtpTime -Server 'ptbtime1.ptb.de'

# Multiple servers via pipeline
'ptbtime1.ptb.de', 'pool.ntp.org', 'time.windows.com' | Get-NtpTime

# Plain DateTime
Get-NtpTime -Server 'ptbtime1.ptb.de' -AsDateTime

# Force IPv6
Get-NtpTime -Server '2.de.pool.ntp.org' -PreferIPv6

# Use NTPv3
Get-NtpTime -Server 'ptbtime1.ptb.de' -NtpVersion 3

Output Object / Ausgabeobjekt

Property Description
LeapIndicator Leap second warning (0 = no warning)
Version NTP version reported by server
Mode NTP mode (4 = server)
Stratum Stratum level (1 = primary, 2+ = secondary)
Poll Maximum poll interval
Precision Clock precision of the server
RootDelay Round-trip delay to primary reference (seconds)
RootDispersion Maximum error relative to primary reference (seconds)
ReferenceIdentifier Stratum 1: clock source (e.g. GPS, PTB); Stratum 2+ IPv4: reference server IP; Stratum 2+ IPv6: MD5 hash fragment
ReferenceTimestamp Last time the server clock was set
OriginateTimestamp Time request left the client
ReceiveTimestamp Time request arrived at server
TransmitTimestamp Time response left the server
UsedNTPServer Server name as queried
UsedNTPServerIP Resolved IP address used
LocalReceiveTime Local time when response arrived
RoundtripDelay Network round-trip delay (seconds)
Offset Clock offset between local and server clock (seconds)

Parameters / Parameter

Parameter Type Default Description
-Server String[] NTP server hostname or IP (pipeline-capable)
-NtpVersion Byte 4 NTP version to send (3 or 4)
-AsDateTime Switch Return TransmitTimestamp as plain DateTime
-PreferIPv6 Switch Prefer IPv6 if available, fall back to IPv4 with warning

Notes / Hinweise

  • IPv6: Fully supported. If -PreferIPv6 is specified but no IPv6 address is available, a warning is issued and IPv4 is used.
  • Extension Fields: The receive buffer accommodates NTPv4 extension fields (1024 bytes). Extension field parsing and NTS (RFC 8915) are not implemented in this version.
  • Stratum 2+ over IPv6: The ReferenceIdentifier contains the first 4 bytes of the MD5 hash of the upstream server's IPv6 address (per RFC 5905), displayed as a hex string (e.g. 49-F2-83-B4).

Requirements / Voraussetzungen

  • PowerShell 5.1 or later / PowerShell 5.1 oder höher
  • Windows, Linux, macOS (PowerShell Core)
  • UDP port 123 outbound must be open

Help / Hilfe

Get-Help Get-NtpTime -Full

Bilingual MAML help included (en-US, de-DE).
Zweisprachige MAML-Hilfe enthalten (en-US, de-DE).


Roadmap

  • Get-PublicIpAddress — query external IP via public API
  • Resolve-HostName — cross-platform DNS resolver with structured output
  • Test-HttpEndpoint — lightweight HTTP availability check
  • NTPv4 Extension Field parsing (future version)
  • NTS support — RFC 8915 (future version)

License / Lizenz

MIT — © Daniel Feiler


Links

About

PowerShell network utilities. Includes a full RFC 5905 NTP client with IPv4/IPv6 support, NTPv3/v4, diagnostic output (stratum, delay, offset, dispersion) and pipeline support for multiple servers. PS 5.1+

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages