claude-home/monitoring/scripts/windows-desktop/windows-setup-instructions.md
Cal Corum 10c9e0d854 CLAUDE: Migrate to technology-first documentation architecture
Complete restructure from patterns/examples/reference to technology-focused directories:

• Created technology-specific directories with comprehensive documentation:
  - /tdarr/ - Transcoding automation with gaming-aware scheduling
  - /docker/ - Container management with GPU acceleration patterns
  - /vm-management/ - Virtual machine automation and cloud-init
  - /networking/ - SSH infrastructure, reverse proxy, and security
  - /monitoring/ - System health checks and Discord notifications
  - /databases/ - Database patterns and troubleshooting
  - /development/ - Programming language patterns (bash, nodejs, python, vuejs)

• Enhanced CLAUDE.md with intelligent context loading:
  - Technology-first loading rules for automatic context provision
  - Troubleshooting keyword triggers for emergency scenarios
  - Documentation maintenance protocols with automated reminders
  - Context window management for optimal documentation updates

• Preserved valuable content from .claude/tmp/:
  - SSH security improvements and server inventory
  - Tdarr CIFS troubleshooting and Docker iptables solutions
  - Operational scripts with proper technology classification

• Benefits achieved:
  - Self-contained technology directories with complete context
  - Automatic loading of relevant documentation based on keywords
  - Emergency-ready troubleshooting with comprehensive guides
  - Scalable structure for future technology additions
  - Eliminated context bloat through targeted loading

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-12 23:20:15 -05:00

4.0 KiB

Windows Reboot Monitor Setup Instructions

This guide will help you set up Discord notifications for Windows reboots due to updates, power outages, or other events.

Prerequisites

  1. Discord Webhook URL: Create a webhook in your Discord server

    • Go to Server Settings → Integrations → Webhooks
    • Create a new webhook and copy the URL
  2. Administrator Access: Required to set up scheduled tasks

Installation Steps

Step 1: Create Scripts Directory

# Run as Administrator
New-Item -ItemType Directory -Path "C:\Scripts" -Force

Step 2: Copy PowerShell Script

  1. Copy windows-reboot-monitor.ps1 to C:\Scripts\
  2. Set execution policy (if needed):
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

Step 3: Configure Discord Webhook

Option A - Environment Variable (Recommended):

# Set system environment variable
[Environment]::SetEnvironmentVariable("DISCORD_WEBHOOK_URL", "YOUR_WEBHOOK_URL_HERE", "Machine")

Option B - Direct parameter:

  • Edit the Task Scheduler XML files to include your webhook URL in the arguments

Step 4: Import Scheduled Tasks

# Import startup monitoring task
schtasks /create /xml "C:\path\to\windows-reboot-task-startup.xml" /tn "Discord Reboot Monitor - Startup"

# Import shutdown monitoring task  
schtasks /create /xml "C:\path\to\windows-reboot-task-shutdown.xml" /tn "Discord Reboot Monitor - Shutdown"

Step 5: Test the Setup

# Test startup notification
C:\Scripts\windows-reboot-monitor.ps1 -EventType "startup"

# Test shutdown notification
C:\Scripts\windows-reboot-monitor.ps1 -EventType "shutdown"

What You'll Get

Startup Notifications (Green/Red)

  • Green: Normal startup with boot reason and uptime info
  • Red: Unexpected restart (power loss, crash, etc.)

Shutdown Notifications (Yellow)

  • System going offline with uptime and shutdown reason

Information Included

  • Computer name
  • Timestamp
  • Boot/shutdown reason (Windows Update, power loss, user initiated)
  • System uptime
  • Startup counter

Troubleshooting

Check Logs

View logs at: C:\Windows\Temp\reboot-monitor.log

Verify Tasks are Running

# List scheduled tasks
Get-ScheduledTask | Where-Object {$_.TaskName -like "*Discord Reboot*"}

# Check task history
Get-WinEvent -LogName "Microsoft-Windows-TaskScheduler/Operational" | Where-Object {$_.LevelDisplayName -eq "Error"}

Test Discord Webhook

# Manual test
$webhook = "YOUR_WEBHOOK_URL"
$payload = @{content = "Test message from Windows"} | ConvertTo-Json
Invoke-RestMethod -Uri $webhook -Method Post -Body $payload -ContentType "application/json"

Common Issues

  1. PowerShell Execution Policy: Run Set-ExecutionPolicy RemoteSigned
  2. Network Issues: Ensure Windows can reach Discord (discord.com)
  3. Permissions: Run PowerShell as Administrator for setup
  4. Webhook URL: Verify the Discord webhook URL is correct

Event Log Monitoring

The script monitors these Windows events:

  • Event ID 1074: System shutdown/restart
  • Event ID 6008: Unexpected shutdown
  • Boot events: System startup

Security Notes

  • Script runs with SYSTEM privileges for reliable monitoring
  • Webhook URL is stored securely in environment variables or config
  • Logs are stored in Windows temp directory
  • No sensitive system information is transmitted

Customization

Edit windows-reboot-monitor.ps1 to:

  • Change Discord message format
  • Add additional system information
  • Modify notification colors
  • Adjust logging behavior
  • Add email notifications as backup

Uninstallation

# Remove scheduled tasks
schtasks /delete /tn "Discord Reboot Monitor - Startup" /f
schtasks /delete /tn "Discord Reboot Monitor - Shutdown" /f

# Remove files
Remove-Item -Path "C:\Scripts\windows-reboot-monitor.ps1" -Force
Remove-Item -Path "C:\Windows\Temp\reboot-monitor.*" -Force

# Remove environment variable
[Environment]::SetEnvironmentVariable("DISCORD_WEBHOOK_URL", $null, "Machine")