claude-home/monitoring/scripts/windows-desktop/README.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

125 lines
4.5 KiB
Markdown

# Windows Desktop Monitoring System
A comprehensive solution for monitoring Windows machine reboots and system events with Discord notifications.
## Overview
This system monitors Windows desktop/workstation machines for:
- System startups (normal and unexpected)
- System shutdowns (planned and unplanned)
- Reboot reasons (Windows Updates, power outages, user-initiated)
- System uptime and boot statistics
## Files
### Core Components
- **`windows-reboot-monitor.ps1`** - Main PowerShell monitoring script
- **`windows-reboot-task-startup.xml`** - Task Scheduler configuration for startup monitoring
- **`windows-reboot-task-shutdown.xml`** - Task Scheduler configuration for shutdown monitoring
- **`windows-setup-instructions.md`** - Complete installation and configuration guide
## Features
### Notification Types
- 🟢 **Normal Startup** - System booted normally after planned shutdown
- 🔴 **Unexpected Restart** - System recovered from power loss, crash, or forced reboot
- 🟡 **Planned Shutdown** - System is shutting down gracefully
### Information Captured
- Computer name and timestamp
- Boot/shutdown reasons (Windows Update, power issues, user actions)
- System uptime duration
- Boot counter for tracking restart frequency
- Event log analysis for root cause determination
### Technical Details
- **PowerShell Script**: Robust error handling and logging
- **Task Scheduler Integration**: Runs automatically on system events
- **Discord Webhooks**: Rich embedded notifications with color coding
- **Event Log Monitoring**: Analyzes Windows System logs for detailed context
- **Configuration Management**: Persistent storage of settings and statistics
## Use Cases
### Primary Scenarios
- **Power Outage Detection** - Immediate alerts when systems restart unexpectedly
- **Windows Update Monitoring** - Track when systems reboot for updates
- **System Health Tracking** - Monitor restart frequency and patterns
- **Remote System Awareness** - Know when remote machines come online/offline
### Advanced Features
- **Reason Classification** - Distinguishes between planned and unplanned reboots
- **Uptime Tracking** - Reports system availability metrics
- **Historical Logging** - Maintains local logs for troubleshooting
- **Configuration Persistence** - Settings survive reboots and updates
## Installation Requirements
### Prerequisites
- Windows 10/11 or Windows Server
- PowerShell 5.1 or later
- Administrator privileges for Task Scheduler setup
- Network connectivity to Discord
- Discord webhook URL
### Dependencies
- Windows Event Log service
- Task Scheduler service
- PowerShell execution policy allowing script execution
## Security Considerations
- Scripts run with SYSTEM privileges for reliable event monitoring
- Webhook URLs stored as environment variables (not in scripts)
- No sensitive system information transmitted in notifications
- Local logging for audit trail
- Execution policy restrictions honored
## Integration Points
### Discord Integration
- Rich embedded messages with color-coded alerts
- Structured data format for easy parsing
- Error handling for network failures
- Retry logic for temporary connectivity issues
### Windows System Integration
- Event Log monitoring (IDs 1074, 6008, boot events)
- Task Scheduler automation
- WMI queries for system information
- Registry access for configuration persistence
## Troubleshooting
Common issues and solutions documented in setup instructions:
- PowerShell execution policy problems
- Network connectivity issues
- Task Scheduler permission errors
- Discord webhook validation failures
## Monitoring Capabilities
### Event Detection
- **Startup Events**: Boot completion, login ready state
- **Shutdown Events**: Planned shutdown initiation
- **Crash Recovery**: Unexpected shutdown detection
- **Update Reboots**: Windows Update initiated restarts
### Data Collection
- **System Metrics**: Uptime, boot time, restart counts
- **Event Correlation**: Links shutdown/startup events
- **Reason Analysis**: Determines root cause of reboots
- **Trend Tracking**: Historical restart patterns
## Deployment Strategy
1. **Single Machine**: Direct installation following setup guide
2. **Multiple Machines**: Script deployment via Group Policy or management tools
3. **Enterprise**: Integration with existing monitoring infrastructure
4. **Home Lab**: Centralized Discord channel for all systems
This monitoring system provides reliable Windows desktop/workstation oversight with minimal resource impact and maximum visibility into system events.