A small utility can solve a specific problem better than a bloated solution. When you need to track your Windows PC’s startup without installing enterprise-grade monitoring tools, a clean notification system is the ideal fix.
That was the motivation behind Windows11Alert, a lightweight Windows utility that automatically sends Telegram notifications whenever your PC turns on. It also reports shutdown or restart events from the Windows Event Logs, ensuring you never miss a critical update about your system’s status.
How Windows11Alert Works
Windows11Alert operates silently in the background. On each system boot, it performs these steps:
- Scans Windows Event Logs to detect the most recent shutdown or restart event.
- Generates a detailed Telegram message with current system information.
- Sends the message to your designated chat via a Telegram bot.
This approach eliminates the unreliability of triggering alerts during shutdown—a process where Windows often terminates network services before scripts can execute properly.
What the Telegram Alert Includes
The notification provides a snapshot of your system at startup. Typical details include:
- Device name and Windows username
- Local and public IP addresses
- Current date and time
- System boot time
- Operating system version and architecture
- Processor model and RAM capacity
If a previous shutdown or restart is detected, a second message follows with the event type and timestamp from the Event Log. This dual-message system ensures you receive both the current status and context about prior activity.
Building Reliability Beyond Shutdown Triggers
The developer initially attempted to send shutdown alerts in real time using methods like:
- Task Scheduler shutdown triggers
- Group Policy shutdown scripts
- Detection via WM_QUERYENDSESSION and WM_ENDSESSION messages
However, testing revealed a critical flaw: many shutdown sequences cut network access before scripts could complete. Instead of fighting this limitation, the project pivoted to reading Event Log entries on the next boot—a far more dependable method.
Core Tools Behind the Utility
Windows11Alert leverages a blend of familiar technologies:
- Python for core logic and system interaction
- Telegram Bot API for secure message delivery
- Windows Registry for seamless auto-startup
- PyInstaller to convert the script into a standalone EXE
- Inno Setup to create a professional Windows installer
Additional libraries like python-dotenv, psutil, and requests handle configuration, system metrics, and API communication.
Setting Up the Telegram Bot in 5 Steps
To receive alerts, users need a Telegram bot and chat ID. Here’s the quick setup process:
- Open Telegram and search for BotFather.
- Send
/newbotand follow the prompts to name your bot. - Copy the bot token provided by BotFather.
- Send a test message to the bot from your account.
- Retrieve your chat ID by visiting
and locating thechat.id` value.
Once configured, store these credentials securely using a .env file to prevent accidental exposure in shared repositories.
Securing Credentials with Environment Files
Hardcoding tokens or chat IDs in source code poses significant security risks. Windows11Alert addresses this by:
- Reading credentials from a
.envfile instead of the script - Adding
.envto the project’s.gitignorefile - Encouraging users to avoid storing tokens in public repositories
While .env files aren’t foolproof—local users with admin rights can access them—they’re far safer than embedding secrets directly in code.
Auto-Startup via Windows Registry
For hands-free operation, Windows11Alert adds itself to the system’s startup sequence using the registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunThe utility uses Python’s winreg module to create this entry automatically, ensuring seamless execution whenever the user logs in.
Detecting Shutdowns with Event Logs
Windows Event Logs contain timestamps and reasons for shutdowns and restarts. Windows11Alert focuses on key event IDs:
- 1074: Planned shutdown initiated by a user or process
- 6006: Clean shutdown, as indicated by the Event Log service stopping
- 6008: Unplanned or unexpected shutdown
By parsing these logs on boot, the utility reconstructs prior events without relying on real-time triggers.
Packaging for Distribution
After development, the project is converted into an executable with PyInstaller:
pyinstaller --onefile --noconsole --icon=alert.ico --name Windows11Alert Windows11Alert.pyAn uninstaller is also bundled:
pyinstaller --onefile --noconsole --icon=uninstaller.ico --name uninstaller uninstaller.pyThese executables are then packaged into a polished Windows installer using Inno Setup, which handles file placement, user prompts for bot credentials, and startup registration.
Why This Utility Stands Out
Windows11Alert delivers a focused solution to a common need: knowing when a PC boots up without installing intrusive monitoring tools. Its reliability stems from leveraging Windows’ native Event Logs rather than fighting the OS’s shutdown timing constraints. For anyone who values simplicity and transparency, this utility offers a clean, configurable way to stay informed about system activity.
AI summary
Windows11Alert, bilgisayarınız açılır açmaz size Telegram bildirimi gönderen bir Windows aracı. Kolay kurulum ve kullanım.