Skip to content

Article: Find What Wakes a Windows PC With Get-WinEvent - #525

Open
trucule wants to merge 3 commits into
PowerShellOrg:mainfrom
trucule:article/find-what-wakes-a-windows-pc
Open

trucule wants to merge 3 commits into
PowerShellOrg:mainfrom
trucule:article/find-what-wakes-a-windows-pc

Conversation

@trucule

@trucule trucule commented Nov 3, 2026

Copy link
Copy Markdown

Closes #428

This adds the article pitched in #428. It builds Get-SleepWakeHistory, which pairs Kernel-Power event 42 with Power-Troubleshooter event 1 to show when a PC slept, why it went to sleep, and what woke it. It then lists the scheduled tasks with WakeToRun set and the devices armed to wake the PC, and shows how to turn off each one.

The code was tested in Windows PowerShell 5.1 and PowerShell 7.6 on two Windows 11 PCs (builds 26200 and 26300), a desktop that uses S3 sleep and a Modern Standby laptop. Every output block in the article comes from those runs.

@netlify

netlify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

👷 Deploy request for powershellorg pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit bb226d4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The missing November archive _index.md causes the required validate:articles CI step to fail.

3 open issues
What changed in this PR

Adds a community troubleshooting article for Windows administrators, implementing the pitch in #428 with a PowerShell function for examining sleep and wake history.

Changes:

  • Introduces Get-SleepWakeHistory to pair sleep and wake events and report durations, reasons, and wake sources.
  • Shows how to identify and disable wake permissions for scheduled tasks and devices.
  • Documents Modern Standby, battery settings, and hibernation limitations with reported test results.

No concerns identified under the article-specific unsafe-content, AI-content-signal, or self-promotion checks. Final publication remains a maintainer decision.

File Description
content/​articles/​2026/​11/​find-what-wakes-a-windows-pc-with-get-winevent/​index.md Adds the troubleshooting article, PowerShell examples, sample output, and platform caveats.

Review effort: Balanced

author: Chris Smith
authors:
- Chris Smith
date: "2026-11-03T00:00:00+00:00"
Comment on lines +135 to +136
Where-Object { $_.TimeCreated -ge $sleptAt.AddMinutes(-2) -and $_.TimeCreated -le $sleptAt.AddMinutes(1) } |
Select-Object -Last 1
ComputerName = $ComputerName
Slept = $sleptAt
Woke = $wokeAt
Asleep = New-TimeSpan -Start $sleptAt -End $wokeAt
trucule and others added 2 commits November 3, 2026 20:24
The validate:articles step requires an _index.md in every month folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXY6pfEzpyB9Cjasa4B4S9
Pick the event 42 closest to SleepTime so a later sleep's event in the window isn't matched, and compute Asleep from the DateTimeOffset values so a sleep across a daylight saving change has the right length.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXY6pfEzpyB9Cjasa4B4S9

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Article] Combining Event Logs

2 participants