Automatically scan your PC for games and add them all to Sunshine for Moonlight streaming. Includes Steam library detection, cover art finding, and duplicate prevention.
- ✅ Mass game detection - Scans multiple drives automatically
- ✅ Steam library support - Parses Steam manifests for proper game names
- ✅ Duplicate detection - Won't re-add games you already have
- ✅ Cover art detection - Finds existing images in game folders
- ✅ Smart filtering - Ignores installers, launchers, and non-game folders
- ✅ UTF-8 safe - Handles special characters in game names
- ✅ Automatic backups - Creates timestamped backups before changes
- Windows with PowerShell 5.1 or higher
- Sunshine installed at default location (
C:\Program Files\Sunshine) - Administrator privileges (required to modify Sunshine config)
Save Add-SunshineGames.ps1 to a location like C:\Scripts\
Edit the script and update the $gamePaths array with your game locations:
$gamePaths = @(
"C:\Games",
"D:\",
"E:\SteamLibrary",
"F:\",
"F:\SteamLibrary"
)Open PowerShell as Administrator:
# Navigate to script location
cd C:\Scripts
# Allow script execution (first time only)
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
# Run the script
.\Add-SunshineGames.ps1Important: Moonlight caches the app list!
To see your new games:
- Open Moonlight on your client device
- Remove your Sunshine host (long-press/right-click → Delete)
- Re-add the host (should auto-discover, or manually add IP)
- Pair if needed
- Games should now appear!
Alternative: Some Moonlight versions have a "Refresh" button in the app list.
- Standalone game executables (.exe files)
- Steam library games (properly named)
- Games with or without cover art
- System folders (WindowsApps, Program Files, etc.)
- Emulator directories (Switch, Wii U, 2DS, etc.)
- Installers and launchers (setup.exe, uninstaller.exe, etc.)
- Utilities (config.exe, updater.exe, etc.)
- Anti-cheat software (EAC, BattleEye, etc.)
Add folders to skip:
$excludeDirs = @(
"WindowsApps", "_CommonRedist", "Program Files",
"YourCustomFolderToSkip" # Add your own here
)Exclude specific exe name patterns:
$excludeExePatterns = @(
"unins", "setup", "launcher",
"mycustompattern" # Add your own here
)If Sunshine is installed elsewhere:
$sunshineConfigPath = "D:\Custom\Path\Sunshine\config\apps.json"-
Get API Key
- Sign up at https://www.steamgriddb.com
- Go to Profile → Preferences → API
- Generate a free API key
-
Run the Cover Art Script
Save Download-GameCoverArt.ps1 and run:
.\Download-GameCoverArt.ps1The script will:
- Search SteamGridDB for each game without cover art
- Download the best matching cover image
- Update Sunshine config with image paths
- Store images in
C:\Program Files\Sunshine\config\covers
You can also manually add images:
- Place image files (PNG, JPG) in your game folders
- Name them:
cover.png,poster.jpg,banner.png, etc. - Re-run the main script - it will find them automatically
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope ProcessThen re-run the script.
Most common cause: Moonlight caches the app list!
Solution:
- Remove the host from Moonlight completely
- Re-add the host
- Reconnect
The script is trying to write to a location that doesn't exist.
Solution: The latest version creates the directory automatically. Make sure you're running as Administrator.
If you see errors like ill-formed UTF-8 byte, a game has special characters causing issues.
Check Sunshine logs:
Get-Content "C:\Program Files\Sunshine\config\sunshine.log" -Tail 50Solution: The script now uses UTF-8 encoding by default. If issues persist, manually remove the problematic game from apps.json.
Verify games are in the config:
$config = Get-Content "C:\Program Files\Sunshine\config\apps.json" -Raw | ConvertFrom-Json
$config.apps.Count # Should show total number of apps
$config.apps | Select-Object -First 10 name # Show first 10 gamesRestart Sunshine service:
Restart-Service -Name "SunshineService" -ForceIf you access Sunshine over Tailscale or VPN:
- Make sure you're editing the config on the actual Sunshine host
- Verify the web UI shows games at
https://YOUR_TAILSCALE_IP:47990 - Refresh Moonlight client as described above
| Item | Location |
|---|---|
| Sunshine Config | C:\Program Files\Sunshine\config\apps.json |
| Sunshine Logs | C:\Program Files\Sunshine\config\sunshine.log |
| Config Backups | C:\Program Files\Sunshine\config\apps.json.backup_TIMESTAMP |
| Downloaded Covers | C:\Program Files\Sunshine\config\covers\ |
========================================
Sunshine Game Mass-Add Script
========================================
✓ Backup created: apps.json.backup_20260112_180000
✓ Found 23 existing games in Sunshine config
📁 Scanning: C:\Games
✓ Found: Eden-Windows
✓ Found: Horizon - Zero Down CE
⊘ Skipped (duplicate): Split Fiction
📁 Scanning: D:\
✓ Found: Cyberpunk 2077 🖼️
✓ Found: God of War Ragnarok 🖼️
...
📁 Scanning: F:\SteamLibrary
✓ Steam: Overwatch
✓ Steam: NARUTO SHIPPUDEN Ultimate Ninja STORM 4
✓ Configuration saved successfully
========================================
📊 SUMMARY
========================================
✓ Added: 89 new games
⊘ Skipped: 14 duplicates
📁 Total in Sunshine: 112 games
💾 Config: C:\Program Files\Sunshine\config\apps.json
========================================
🖼️ Found images for 23/89 games
⚠️ NEXT STEPS:
1. Restart Sunshine service (option below)
2. In Moonlight: Remove and re-add your host to refresh app list
3. Optionally: Add custom cover art (see script comments)
Restart Sunshine service now? (Y/N):
.\Add-SunshineGames.ps1
# Answer 'N' to service restart prompt, or modify script to auto-restartCreate a scheduled task to run weekly:
$action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-ExecutionPolicy Bypass -File C:\Scripts\Add-SunshineGames.ps1"
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Sunday -At 3am
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Sunshine Game Sync" -Description "Auto-add new games to Sunshine" -RunLevel Highest$config = Get-Content "C:\Program Files\Sunshine\config\apps.json" -Raw | ConvertFrom-Json
$config.apps | Select-Object name, cmd | Export-Csv "sunshine_games.csv" -NoTypeInformationFound a bug? Have a suggestion? This script was created to solve a specific problem - feel free to modify it for your needs!
Common improvements you might want:
- Add support for GOG Galaxy libraries
- Add support for Epic Games Store
- Implement better image quality selection
- Add categories/tags for games
- Create Sunshine "collections" automatically
- Created for use with Sunshine and Moonlight
- Cover art powered by SteamGridDB
Free to use and modify. No warranty provided. Use at your own risk.
💡 Tip: After running the script for the first time, you can run it again whenever you install new games. It will only add new ones thanks to duplicate detection!