WorkTimer is a simple PowerShell script that enforce limited sessions. It runs a 1-hour countdown timer, gives spoken and visual notifications before time runs out, and logs out the user automatically. The script is designed to be run at user login and supports Cyrillic output.
- ✅ 1-hour countdown (default)
- 🔔 Visual + spoken alerts at customizable time thresholds
- 🧪 Test mode for fast debugging (15s countdown)
- 🚪 Automatic forced logoff when time is up
- 🖥️ Fully compatible with Windows 11, using only built-in tools (PowerShell + VBScript)
WorkTimer.ps1 # Main PowerShell script with alert + logout logic
WorkTimer.vbs # Helper VBScript to run the PowerShell script silently
README.md # This documentation
To start a 1-hour session:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File WorkTimer.ps1This uses default alert thresholds: 10, 5, and 1 minute remaining.
Quick 15s run for testing (alerts at 10s, 5s, and 1s):
powershell.exe -NoProfile -ExecutionPolicy Bypass -File WorkTimer.ps1 -Test -VerboseIn test mode:
- Shortened countdown
- Verbose output
- No logout
Quck 15s run for testing with logout:
powersherll.exe -NoProfile -ExecutionPolicy Bypass -File WorkTimer.ps1 -Test -Shutdown -Verbosepowershell.exe -File WorkTimer.ps1 -Thresholds @(900, 300, 60)This triggers alerts at 15, 5, and 1 minute remaining.
Each alert:
- Shows a balloon tip via Windows Forms
- Speaks a message using SAPI (text-to-speech)
The script supports Unicode messages (e.g. Cyrillic).
To configure the script to run at user login using Task Scheduler:
- Copy
WorkTimer.ps1andWorkTimer.vbsto a foler, e.g.C:\Scripts\ - Press
Win + R, typetaskschd.msc - Click Create Task...
- On the General tab:
- Name:
WorkTimer - Description:
Logout user after 1 hour - When running the task, use the following user account:
- Click Change User or Group
- In Enter the object name to select (examples): type user name of user, which u want it script to work.
- Press Check Names
- Press OK
- On the Triggers tab:
- Click New...
- Begin the task: At log on
- Select Specific user:
- Choose user account as you did before
- Click OK
- On the Actions tab:
- Click New...
- Action: Start a program
- Program/script:
wscript.exe - Add arguments:
C:\Scripts\WorkTimer.vbs - Click OK
- Click OK to save the task
This setup ensures the script runs silently via the .vbs wrapper each time user logs in.
You may need to allow script execution:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserIf the script was downloaded:
Unblock-File -Path WorkTimer.ps1Or just bypass execution policy for this script:
powershell.exe -ExecutionPolicy Bypass -File WorkTimer.ps1The included WorkTimer.vbs allows you to launch the PowerShell script silently (no terminal window):
Set shell = CreateObject("WScript.Shell")
shell.Run "powershell -NoProfile -ExecutionPolicy Bypass -File C:\Scripts\WorkTimer.ps1", 0Useful for auto-start without interrupting the user.
MIT License. Use it, tweak it, improve it.