A PowerShell script that monitors system idle time and automatically manages LaunchBox/BigBox processes and other applications. When the system is idle, it closes specified processes and activates the screensaver. When activity is detected, it restores BigBox and optionally restarts other configured processes.
- 🎮 Monitors system idle time
- 🔄 Automatically closes LaunchBox/BigBox and other processes during idle
- 🖥️ Activates screensaver when idle threshold is reached
- ⚡ Automatically restores BigBox when user returns
- 📊 Clean, timestamped logging with color-coded messages
- ⚙️ Highly configurable process management
- Windows 10/11
- PowerShell 5.1 or later
- LaunchBox/BigBox installed
- Administrator privileges (recommended for process management)
- Clone or download this repository
- Open
LBAutoLaunch.ps1in a text editor - Configure the script according to your needs (see Configuration section)
Edit the configuration section at the top of the script:
# Idle time threshold to trigger actions (in seconds)
$idleThresholdSeconds = 180
# BigBox.exe path
$bigBoxPath = "C:\emu\LaunchBox\BigBox.exe"
# Check interval (in seconds)
$checkIntervalSeconds = 5Edit the $procsToKill array to specify which processes should be closed when idle:
$procsToKill = @(
"LaunchBox",
"BigBox",
"brave" # Brave Browser
# Add more processes here
)When editing arrays in PowerShell, pay attention to commas:
- Items in the middle must have a comma at the end:
"LaunchBox", - The last item should NOT have a comma:
"brave"(not"brave",)
Correct example:
$procsToKill = @(
"LaunchBox", # ✅ Comma here
"BigBox", # ✅ Comma here
"brave" # ✅ NO comma on last item
)Incorrect example:
$procsToKill = @(
"LaunchBox", # ✅ Comma here
"BigBox", # ✅ Comma here
"brave", # ❌ Extra comma on last item - will cause syntax error!
)Configure processes that should be restarted when the user returns:
$procsToRestart = @(
# "Discord", # Restart Discord when returning
# "Steam", # Restart Steam when returning
)If you need to specify custom paths for restarting processes:
$procPathsToRestart = @{
"Discord" = "C:\Users\$env:USERNAME\AppData\Local\Discord\Update.exe"
"Steam" = "C:\Program Files (x86)\Steam\steam.exe"
}- Open PowerShell (as Administrator recommended)
- Navigate to the script directory
- Run the script:
.\LBAutoLaunch.ps1If you encounter execution policy errors, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserThen run the script again.
To make the script run automatically when Windows starts, you can add it to the Startup folder.
-
Press
Win + Rto open the Run dialog -
Type
shell:startupand press Enter- This opens your user's Startup folder:
C:\Users\YourUsername\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
- This opens your user's Startup folder:
-
Create a shortcut to the PowerShell script:
- Right-click in the Startup folder
- Select "New" → "Shortcut"
- Browse to your
LBAutoLaunch.ps1file - Click "Next" and give it a name (e.g., "LBAutoLaunch")
- Click "Finish"
-
Important: Edit the shortcut properties:
- Right-click the shortcut → "Properties"
- In the "Target" field, change it to:
(Replace
powershell.exe -WindowStyle Hidden -ExecutionPolicy Bypass -File "Z:\LBAutoLaunch.ps1"Z:\LBAutoLaunch.ps1with your actual script path) - Click "OK"
- Open Task Scheduler (
Win + R→taskschd.msc) - Click "Create Basic Task" in the right panel
- Name it "LBAutoLaunch" and click "Next"
- Select "When I log on" and click "Next"
- Select "Start a program" and click "Next"
- Configure:
- Program/script:
powershell.exe - Add arguments:
-WindowStyle Hidden -ExecutionPolicy Bypass -File "Z:\LBAutoLaunch.ps1" - (Replace with your actual script path)
- Program/script:
- Click "Next" → "Finish"
Run this in PowerShell (as Administrator):
$scriptPath = "Z:\LBAutoLaunch.ps1" # Change to your script path
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run"
$regName = "LBAutoLaunch"
$regValue = "powershell.exe -WindowStyle Hidden -ExecutionPolicy Bypass -File `"$scriptPath`""
Set-ItemProperty -Path $regPath -Name $regName -Value $regValueTo remove the auto-start later:
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "LBAutoLaunch"- Monitoring: The script continuously monitors system idle time (time since last user input)
- Idle Detection: When idle time exceeds the threshold (default: 180 seconds):
- Closes all configured processes (LaunchBox, BigBox, browsers, etc.)
- Activates the screensaver
- Activity Detection: When user activity is detected:
- Closes the screensaver
- Restarts BigBox
- Optionally restarts other configured processes
The script provides detailed logging with timestamps and color-coded messages:
- INFO (White): General information
- SUCCESS (Green): Successful operations
- WARNING (Yellow): Warnings (e.g., process already running)
- ERROR (Red): Errors that occurred
- STATUS (Cyan): Real-time idle status
- Check PowerShell execution policy:
Get-ExecutionPolicy - Run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
- Ensure you're running PowerShell as Administrator
- Verify process names are correct (without .exe extension)
- Check if processes have special permissions
- Verify the
$bigBoxPathis correct - Check if BigBox.exe exists at the specified path
- Review error messages in the console
- Remember: NO comma after the last item in PowerShell arrays
- Check for missing commas between items (except the last one)
# Close these during idle
$procsToKill = @(
"LaunchBox",
"BigBox",
"brave",
"Discord",
"Steam"
)
# Restart these when user returns
$procsToRestart = @(
"Discord",
"Steam"
)
# Paths for restarting
$procPathsToRestart = @{
"Discord" = "C:\Users\$env:USERNAME\AppData\Local\Discord\Update.exe"
"Steam" = "C:\Program Files (x86)\Steam\steam.exe"
}This script is provided as-is for personal use. Feel free to modify and adapt it to your needs.
Contributions, suggestions, and improvements are welcome!
- The script runs in an infinite loop - close the PowerShell window to stop it
- For best results, run as Administrator to ensure all processes can be managed
- Test your configuration before setting up auto-start to avoid issues at boot