- Complete PowerShell-based monitoring solution for Windows reboots - Detects startup, shutdown, and unexpected restart events - Rich Discord notifications with color-coded alerts - Automatic reboot reason detection (Windows Update, power loss, user-initiated) - Task Scheduler integration for reliable event monitoring - Comprehensive setup instructions and troubleshooting guide 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
51 lines
2.0 KiB
XML
51 lines
2.0 KiB
XML
<?xml version="1.0" encoding="UTF-16"?>
|
|
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
<RegistrationInfo>
|
|
<Date>2024-01-01T00:00:00</Date>
|
|
<Author>System Administrator</Author>
|
|
<Description>Monitor system shutdown and send Discord notification</Description>
|
|
</RegistrationInfo>
|
|
<Triggers>
|
|
<SessionStateChangeTrigger>
|
|
<Enabled>true</Enabled>
|
|
<StateChange>SessionLock</StateChange>
|
|
</SessionStateChangeTrigger>
|
|
<EventTrigger>
|
|
<Enabled>true</Enabled>
|
|
<Subscription><QueryList><Query Id="0" Path="System"><Select Path="System">*[System[Provider[@Name='User32'] and EventID=1074]]</Select></Query></QueryList></Subscription>
|
|
</EventTrigger>
|
|
</Triggers>
|
|
<Principals>
|
|
<Principal id="Author">
|
|
<UserId>S-1-5-18</UserId>
|
|
<RunLevel>HighestAvailable</RunLevel>
|
|
</Principal>
|
|
</Principals>
|
|
<Settings>
|
|
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
<AllowHardTerminate>true</AllowHardTerminate>
|
|
<StartWhenAvailable>true</StartWhenAvailable>
|
|
<RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>
|
|
<IdleSettings>
|
|
<StopOnIdleEnd>false</StopOnIdleEnd>
|
|
<RestartOnIdle>false</RestartOnIdle>
|
|
</IdleSettings>
|
|
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
<Enabled>true</Enabled>
|
|
<Hidden>false</Hidden>
|
|
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
|
|
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
|
|
<WakeToRun>false</WakeToRun>
|
|
<ExecutionTimeLimit>PT2M</ExecutionTimeLimit>
|
|
<Priority>7</Priority>
|
|
</Settings>
|
|
<Actions Context="Author">
|
|
<Exec>
|
|
<Command>powershell.exe</Command>
|
|
<Arguments>-ExecutionPolicy Bypass -File "C:\Scripts\windows-reboot-monitor.ps1" -EventType "shutdown"</Arguments>
|
|
</Exec>
|
|
</Actions>
|
|
</Task> |