Skip to content

time_sync_fix.ps1

Corey Watson edited this page Dec 24, 2025 · 2 revisions

time_sync_fix.ps1

Fix Windows time synchronization issues.

Overview

Fixes Windows time synchronization by setting the timezone, resetting the Windows Time service, configuring NTP servers, and forcing a time sync. Resolves common time drift and synchronization issues.

Purpose

Resolves Windows time synchronization problems that can cause authentication failures, certificate errors, and other time-sensitive issues on managed endpoints.

Prerequisites

  • Windows 10/11
  • Admin privileges required
  • Network connectivity to NTP servers

Configuration

Required Inputs

  • TimeZone: Windows timezone ID (e.g., "Eastern Standard Time")
  • NtpServers: Comma-separated list of NTP servers

Settings

  • Uses pool.ntp.org servers by default
  • Sets SpecialPollInterval to 86400 seconds (24 hours)
  • Configures w32time triggers for network on/off

Behavior

  1. Sets the system timezone
  2. Stops the Windows Time service
  3. Unregisters and re-registers w32time
  4. Configures NTP poll interval in registry
  5. Sets service triggers for network connectivity
  6. Starts the Windows Time service
  7. Configures NTP server list
  8. Forces immediate time resync

Security Notes

  • No secrets in logs
  • Modifies system time settings
  • Uses public NTP servers

Exit Codes

  • 0: Success
  • 1: Failure

Example Output

[ INPUT VALIDATION ]
--------------------------------------------------------------
Time Zone   : Eastern Standard Time
NTP Servers : 0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org

[ OPERATION ]
--------------------------------------------------------------
Setting timezone...
Stopping Windows Time service...
Re-registering Windows Time service...
Configuring NTP poll interval...
Setting service triggers...
Starting Windows Time service...
Configuring NTP servers...
Forcing time resync...

[ RESULT ]
--------------------------------------------------------------
Status    : Success
Time Zone : Eastern Standard Time
Time      : 2025-11-29 14:32:15

[ SCRIPT COMPLETED ]
--------------------------------------------------------------

Version History

  • v1.0.0 (2025-11-29): Initial Style A implementation

Links

Clone this wiki locally