Here’s a PowerShell script that resets video/display settings when switching GPUs. It focuses on:
- Clearing display resolutions and refresh rates
- Resetting display scaling and layout
- Removing custom ICC profiles
- Flushing DirectX shader cache
- Clearing Nvidia/AMD specific settings (optional)
⚠️ This script does not reinstall drivers but assumes drivers for both GPUs are installed and switching is done via hardware or software (e.g., eGPU, BIOS).
# Run as Administrator
Write-Host "Resetting Display Settings..." -ForegroundColor Cyan
# Reset display layout to default (primary only)
Start-Process -FilePath "DisplaySwitch.exe" -ArgumentList "/internal" -Wait
# Remove custom display settings from registry (resolution, scaling, etc.)
$regPaths = @(
"HKCU:\Control Panel\Desktop",
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Display",
"HKCU:\Software\Microsoft\Windows\CurrentVersion\ThemeManager"
)
foreach ($path in $regPaths) {
Write-Host "Resetting registry keys in $path"
try {
Remove-ItemProperty -Path $path -Name "LogPixels" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $path -Name "DpiScalingVer" -ErrorAction SilentlyContinue
} catch {
Write-Host "Error modifying $path: $_" -ForegroundColor Yellow
}
}
# Reset screen resolution via DisplaySettings (fallback)
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
Write-Host "Detected monitor: $($_.DeviceName), resolution: $($_.Bounds.Width)x$($_.Bounds.Height)"
}
# Flush DirectX Shader Cache
$dxCache = "$env:LOCALAPPDATA\D3DSCache"
if (Test-Path $dxCache) {
Write-Host "Flushing DirectX shader cache..."
Remove-Item "$dxCache\*" -Recurse -Force -ErrorAction SilentlyContinue
}
# Reset NVIDIA or AMD settings
Write-Host "Looking for NVIDIA/AMD profile tools..." -ForegroundColor DarkGray
# Optional: NVIDIA Control Panel settings (requires nvidiaProfileInspector or nv-cleaninstall)
# Optional: AMD Radeon Settings (no public CLI for resets)
# Clear display color profiles
$colorProfiles = "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\ICM"
if (Test-Path $colorProfiles) {
Write-Host "Removing ICC color profiles..."
Remove-Item "$colorProfiles\*" -Recurse -Force -ErrorAction SilentlyContinue
}
# Optional reboot prompt
$choice = Read-Host "Reboot now to apply all changes? (Y/N)"
if ($choice -eq "Y") {
Restart-Computer
} else {
Write-Host "Changes will apply after manual restart." -ForegroundColor Green
}
PowerShellExplanation
Feature | Purpose |
---|---|
DisplaySwitch.exe /internal | Forces output to primary screen (e.g., after GPU swap or docking) |
Registry cleanup | Resets resolution, scaling, theme display info |
Shader cache flush | Avoids graphical glitches after GPU change |
Color profile removal | Prevents ICC conflicts from previous GPU setups |
Consider
Reset Windows Display Calibration: dccw.exe
Use tools like NVCleanstall (NVIDIA) or AMD Cleanup Utility for deep driver cleanup.
Automate resolution scaling with Display Changer II
(third-party CLI tool)
DISCLAIMER
Indemnification
By using this script or any accompanying documentation, you agree that the author(s), publisher(s), and distributor(s) shall not be held liable for any damages, data loss, hardware malfunction, or unintended consequences arising from its use, misuse, or modification.
You assume full responsibility for evaluating the fitness of this script for your specific hardware and software configuration. You agree to indemnify, defend, and hold harmless the author(s) from and against any and all claims, liabilities, damages, losses, and expenses—including legal fees—arising out of or in any way connected with your use of this script or any derivative works created from it.
This tool is provided “as-is”, without warranties or guarantees of any kind, express or implied. Always back up your system settings before proceeding with system-level changes.