Overview
The HDRswitch-VDD.ps1 script provides an automated way to toggle HDR (High Dynamic Range) mode on the Virtual Display Driver. It detects the current color depth and switches between standard (8-bit) and HDR (10-bit) color modes.
Features
- Automatic HDR detection: Checks current bits per color channel
- Intelligent toggling: Switches between 8-bit and 10-bit+ color modes
- Automatic elevation: Self-elevates to Administrator privileges
- Dependency management: Automatically installs required PowerShell modules
Requirements
This script requires Administrator privileges and will automatically request elevation through UAC if not already running as Administrator.
- Virtual Display Driver must be installed and enabled
- PowerShell 5.1 or later
- Internet connection (for first run to install dependencies)
- Required PowerShell modules (automatically installed):
DisplayConfig v1.1.1
MonitorConfig v1.0.3
- HDR-capable Virtual Display Driver version
Parameters
This script takes no parameters. It automatically detects the current HDR state and toggles it.
Usage Examples
Toggle HDR
This will:
- If HDR is enabled (10-bit color): Disable HDR (switch to 8-bit)
- If HDR is disabled (8-bit color): Enable HDR (switch to 10-bit)
Run from Command Prompt
powershell.exe -ExecutionPolicy Bypass -File .\HDRswitch-VDD.ps1
Create Desktop Shortcut for HDR Toggle
- Right-click desktop → “New” → “Shortcut”
- Target:
powershell.exe -ExecutionPolicy Bypass -File "C:\Path\To\HDRswitch-VDD.ps1"
- Name: “Toggle VDD HDR”
- Right-click shortcut → Properties → Advanced
- Check “Run as administrator”
How It Works
1. Self-Elevation
First checks for Administrator privileges:
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
# Relaunch with elevation
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
2. Dependency Installation
Sources the set-dependencies.ps1 script to install/import required modules:
DisplayConfig - For display configuration management
MonitorConfig - For monitor-specific settings
3. Display Identification
Finds the Virtual Display Driver:
$disp = Get-DisplayInfo | Where-Object { $_.DisplayName -eq "VDD by MTT" }
4. Color Depth Detection
Checks the current bits per color channel:
$bpcc = Get-DisplayColorInfo -DisplayId $disp.DisplayId |
Select-Object BitsPerColorChannel |
Select-Object -ExpandProperty BitsPerColorChannel
Possible values:
- 8 bits: Standard color mode (SDR)
- 10 bits or higher: HDR mode enabled
5. HDR Toggle Logic
if ($bpcc -gt 8) {
# Currently in HDR mode - disable it
Disable-DisplayAdvancedColor -DisplayId $disp
}
elseif ($bpcc -lt 10) {
# Currently in SDR mode - enable HDR
Enable-DisplayAdvancedColor -DisplayId $disp
}
Script Source
Here’s the complete script:
# Self-elevate the script if required
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
}
# Install dependencies if required
. "$PSScriptRoot\set-dependencies.ps1"
# Getting the correct display
$disp = Get-DisplayInfo | Where-Object { $_.DisplayName -eq "VDD by MTT" }
$bpcc = Get-DisplayColorInfo -DisplayId $disp.DisplayId |
Select-Object BitsPerColorChannel |
Select-Object -ExpandProperty BitsPerColorChannel
if ($bpcc -is [int]) {
if ($bpcc -gt 8) {
Disable-DisplayAdvancedColor -DisplayId $disp
break
}
if ($bpcc -lt 10) {
Enable-DisplayAdvancedColor -DisplayId $disp
break
}
}
else {
write-error "Something went wrong in identifying the Colormode of the display."
break
}
Understanding HDR
What is HDR?
HDR (High Dynamic Range) provides:
- Wider color gamut: More colors than standard (SDR)
- Higher brightness range: Better contrast between light and dark
- Better color accuracy: 10-bit or higher color depth vs 8-bit
Bits Per Color Channel
| Bits | Color Mode | Colors per Channel | Total Colors |
|---|
| 8-bit | SDR | 256 | ~16.7 million |
| 10-bit | HDR | 1,024 | ~1.07 billion |
| 12-bit | Deep HDR | 4,096 | ~68.7 billion |
When to Use HDR
Enable HDR for:
- Video playback with HDR content
- HDR gaming
- Photo/video editing with HDR support
- Streaming services with HDR (Netflix, YouTube, etc.)
Disable HDR for:
- Better compatibility with older applications
- Reduced resource usage
- Some games that don’t support HDR properly
- When colors appear washed out
Troubleshooting
Error: “Display not found”
Cause: Virtual Display Driver is not installed or enabled.
Solution:
# Check driver status
.\virtual-driver-manager.ps1 -Action status
# Enable if disabled
.\virtual-driver-manager.ps1 -Action enable
Error: “Something went wrong in identifying the Colormode”
Possible causes:
- Display is in an error state
- DisplayConfig module failed to get color info
- Display is not properly initialized
Solutions:
# Try toggling the driver
.\toggle-VDD.ps1
Start-Sleep -Seconds 2
.\toggle-VDD.ps1
# Check display info manually
Get-DisplayInfo | Where-Object { $_.DisplayName -eq "VDD by MTT" } | Format-List
# Check color info
$disp = Get-DisplayInfo | Where-Object { $_.DisplayName -eq "VDD by MTT" }
Get-DisplayColorInfo -DisplayId $disp.DisplayId | Format-List
HDR Doesn’t Enable/Disable
Possible causes:
- Driver version doesn’t support HDR
- System doesn’t have HDR support
- Display settings preventing toggle
Solutions:
# Verify driver version supports HDR
# Look for "HDR" in friendly name:
Get-PnpDevice | Where-Object { $_.FriendlyName -like "*HDR*" }
# Check if display supports advanced color
$disp = Get-DisplayInfo | Where-Object { $_.DisplayName -eq "VDD by MTT" }
Get-DisplayColorInfo -DisplayId $disp.DisplayId
# Update to latest driver version
.\virtual-driver-manager.ps1 -Action install -DriverVersion latest
Module Installation Issues
If the script can’t install required modules:
# Manually install modules
Install-Module -Name DisplayConfig -RequiredVersion 1.1.1 -Scope CurrentUser -Force
Install-Module -Name MonitorConfig -RequiredVersion 1.0.3 -Scope CurrentUser -Force
# Verify installation
Get-Module -ListAvailable DisplayConfig, MonitorConfig
Script Requires set-dependencies.ps1
Ensure both files are in the same directory:
Community Scripts/
├── HDRswitch-VDD.ps1
└── set-dependencies.ps1
Checking Current HDR Status
To check if HDR is currently enabled without toggling:
# Import required module
Import-Module DisplayConfig
# Get display
$disp = Get-DisplayInfo | Where-Object { $_.DisplayName -eq "VDD by MTT" }
# Get color depth
$colorInfo = Get-DisplayColorInfo -DisplayId $disp.DisplayId
$bpcc = $colorInfo.BitsPerColorChannel
if ($bpcc -gt 8) {
Write-Host "HDR is ENABLED ($bpcc-bit color)"
} else {
Write-Host "HDR is DISABLED ($bpcc-bit color)"
}
Automation Examples
Enable HDR for Specific Application
Create a launcher that enables HDR before starting an application:
# enable-hdr-and-launch.ps1
param([string]$AppPath)
# Get current HDR state
$disp = Get-DisplayInfo | Where-Object { $_.DisplayName -eq "VDD by MTT" }
$bpcc = Get-DisplayColorInfo -DisplayId $disp.DisplayId | Select-Object -ExpandProperty BitsPerColorChannel
# Enable HDR if not already enabled
if ($bpcc -le 8) {
Write-Host "Enabling HDR..."
& "$PSScriptRoot\HDRswitch-VDD.ps1"
Start-Sleep -Seconds 1
}
# Launch application
Write-Host "Launching $AppPath"
Start-Process $AppPath
Usage:
.\enable-hdr-and-launch.ps1 "C:\Games\MyHDRGame.exe"
Batch File Toggle
Create hdr-toggle.bat:
@echo off
echo Toggling HDR on Virtual Display Driver...
powershell.exe -ExecutionPolicy Bypass -File "%~dp0HDRswitch-VDD.ps1"
pause
Task Scheduler - Auto-enable HDR at Login
$action = New-ScheduledTaskAction -Execute "powershell.exe" `
-Argument "-ExecutionPolicy Bypass -File C:\Scripts\enable-hdr.ps1"
$trigger = New-ScheduledTaskTrigger -AtLogOn
$principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest
Register-ScheduledTask -TaskName "Enable VDD HDR at Logon" `
-Action $action `
-Trigger $trigger `
-Principal $principal
Create enable-hdr.ps1:
# Only enable if currently disabled
$disp = Get-DisplayInfo | Where-Object { $_.DisplayName -eq "VDD by MTT" }
$bpcc = Get-DisplayColorInfo -DisplayId $disp.DisplayId | Select-Object -ExpandProperty BitsPerColorChannel
if ($bpcc -le 8) {
Enable-DisplayAdvancedColor -DisplayId $disp
}