Windows update restart fix

From ksmaster03/claude-canfly-skill · View interactive version

Windows update restart fix is an AI agent skill from the GitHub repository ksmaster03/claude-canfly-skill. หาสาเหตุที่เครื่อง Windows restart เองทุกวันจาก event log แล้วซ่อนอัปเดตที่ลงไม่ผ่านจน Windows Update สั่ง restart วนทุกคืน. Trigger เมื่อพิมพ์ /windows-update-restart-fix หรือถามว่า "เครื่อง restart เองทุกวัน / รีสตาร์ทเองตอนกลางคืน / ทำไมเครื่องรีบูต / บริการดับตอนเช้า".

How to use this skill

Skill file

windows-update-restart-fix

ใช้เมื่อ: เครื่อง Windows รีบูตเองเป็นประจำ หรือบริการที่เริ่มตอน login หายไปทุกเช้า

ขั้นตอน (รันจริงแล้วบน DESKTOP-H26BL86, 2026-10-17)

  1. ดูว่าใครสั่ง restart อ่านได้โดยไม่ต้องเป็น admin:

```powershell

Get-WinEvent -FilterHashtable @{LogName='System'; Id=1074,6008,41; StartTime=(Get-Date).AddDays(-10)} |

Sort-Object TimeCreated | ForEach-Object { '{0:MM-dd HH:mm} [{1}] {2}' -f $_.TimeCreated, $_.Id, ($_.Message -replace '\s+',' ').Substring(0,200) }

```

  1. ดูว่าอัปเดตตัวไหนลงไม่ผ่านซ้ำ ๆ (event 20 = ล้มเหลว, 19 = สำเร็จ, 43 = เริ่ม):

```powershell

Get-WinEvent -FilterHashtable @{LogName='System'; ProviderName='Microsoft-Windows-WindowsUpdateClient'; StartTime=(Get-Date).AddDays(-10)} |

Where-Object Id -eq 20 | ForEach-Object { '{0:MM-dd HH:mm} {1}' -f $_.TimeCreated, ($_.Message -replace '\s+',' ') }

```

ถ้าตัวเดียวกันล้มตรงเวลาเดียวกับ restart ทุกคืน ตัวนั้นคือต้นเหตุ เช่น Pantum Printer Driver Update (1.0.16.0) error 0x8024200B

  1. ดู active hours ประกอบ: Get-ItemProperty HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings (restart จะเกิดนอกช่วงนี้)
  2. ซ่อนอัปเดตตัวนั้น ต้องใช้ admin: ให้ผู้ใช้กด Yes ที่ UAC แล้วอ่านผลจาก log:

```powershell

$s = "$env:USERPROFILE\.claude\skills\windows-update-restart-fix\scripts\hide-update.ps1"

Start-Process powershell.exe -Verb RunAs -Wait -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-File',""$s"",'-Pattern','Pantum'

Get-Content "$env:USERPROFILE\.claude\skills\windows-update-restart-fix\scripts\hide-update.log"

```

ต้องเห็นชื่ออัปเดตใต้ all hidden updates now

  1. ยืนยันผลหลังผ่านไปสองคืน ด้วยคำสั่งข้อ 1 และ 2

Gotchas

ยังไม่เคยรันจริง

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.