Logo Vibhu Bhatnagar — PowerShell & Infrastructure Engineer
  • Home
  • About
  • Skills
  • Experiences
  • More
    Education Projects PowerShell Modules Articles Recent Posts Accomplishments
  • Posts
  • Notes
  • Hire Me
  • GitHub
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • Tags
  • Active Directory
  • AI
  • AI Tools
  • Automation
  • Azure AD
  • Design Systems
  • Developer Tools
  • GPO
  • Intune
  • MCP
  • Module
  • MSP
  • NTP
  • PowerShell
  • Printers
  • RDP
  • Registry
  • Remote Management
  • RMM
  • Sysadmin
  • SYSTEM
  • W32tm
  • Windows
  • Windows Administration
  • Windows Server
  • WinRM
Hero Image
Fix Windows Time Sync with w32tm

Purpose Windows system clock drifting or refusing to sync. This script detects whether the machine is domain-joined and takes the correct NTP path automatically — no manual branching needed. Approach If domain-joined → restore AD hierarchy sync (fighting domain policy with internet NTP is a support ticket waiting to happen) If workgroup/standalone → configure public NTP peers and force resync The Script Run as Administrator: $isDomainJoined = (Get-CimInstance Win32_ComputerSystem).PartOfDomain if ($isDomainJoined) { Write-Host "Domain-joined — syncing from AD hierarchy" -ForegroundColor Cyan w32tm /config /syncfromflags:domhier /update Restart-Service w32time w32tm /resync /force } else { Write-Host "Workgroup machine — configuring public NTP" -ForegroundColor Cyan w32tm /config /manualpeerlist:"time.google.com time.cloudflare.com pool.ntp.org" /syncfromflags:manual /reliable:no /update Restart-Service w32time w32tm /resync /force } If Resync Fails Re-register the Windows Time Service, then re-run the script above:

  • PowerShell
  • Windows
  • Windows Server
  • NTP
  • w32tm
Friday, May 22, 2026 | 2 minutes Read
Navigation
  • About
  • Skills
  • Experiences
  • Education
  • Projects
  • PowerShell Modules
  • Articles
  • Recent Posts
  • Accomplishments
  • GitHub
Contact me:
  • vibhu@pwsh.in
  • Facebook: vibhu@pwsh.in
  • Vibhu2
  • Vibhu Bhatnagar
  • +91 8979989222
  • Reddit: VibhuPwsh
  • Twitter: VibhuBhatn54299

Liability Notice: The views and opinions expressed on this blog are my own and do not represent those of my employer. All content is provided for informational purposes only.


Toha Theme Logo Toha
© 2026 Vibhu Bhatnagar. All rights reserved.
Powered by Hugo Logo