A PowerShell script that let group members request screenshots of a shift planner via a Telegram bot β authenticated with stored passwords.
β οΈ This is an archived project. It was built for a specific use case at a previous job and is no longer actively maintained. The code is preserved here as a reference and portfolio piece.
The shift planner at work was a desktop application with no API and no remote access. Team members who needed to check their shifts while away from the office had no way to see the schedule.
This script solved that by running on the machine where the shift planner was installed. It:
- Listened for incoming Telegram messages via the Bot API (polling loop)
- Authenticated the user by checking their stored password
- Brought the shift planner window to the foreground using Win32 API calls (
ShowWindowAsync) - Captured a screenshot of a defined screen region using
System.Drawing - Sent the screenshot back to the user via the Telegram Bot API
The entire flow happened within ~60 seconds of the initial request.
ββββββββββββββββ ββββββββββββββββββββββββ ββββββββββββββββββββ
β Team Member β β PowerShell Script β β Shift Planner β
β on Telegram ββββββΆβ (running on PC) ββββββΆβ (local app) β
β β β β β β
β "Beispiel1" β β 1. Match username β β Window brought β
β βββββββ 2. Ask for password βββββββ to foreground β
β "mypass123" ββββββΆβ 3. Verify password β β β
β β β 4. Screenshot region β β Screenshot β
β π· Image βββββββ 5. Send via Bot API β β captured β
ββββββββββββββββ ββββββββββββββββββββββββ ββββββββββββββββββββ
PS-Telegram-Request-Screenshot/
βββ screenshot-bot.ps1 # Main script (polling loop, auth, capture, send)
βββ README.md
- PowerShell 5.1 with
System.Drawingfor screen capture - Win32 API (
user32.dll) for window management - Telegram Bot API for messaging and photo delivery
- curl for multipart file uploads to Telegram
- The script used hardcoded passwords per user β this was an internal tool on a trusted network, not a production security model
- Screen coordinates for the capture region were hardcoded to match the specific shift planner window layout
- The polling loop ran indefinitely with 120-second sleep intervals between checks
- π Initial release
- β¨ Telegram Bot API polling loop
- β¨ Password-based user authentication
- β¨ Win32 window management and screen capture
- β¨ Automatic screenshot delivery via Telegram
Unlicensed β provided as-is for reference.
Made with π€ by cheswick.dev