Overview
Thevirtual-driver-manager.ps1 script provides a complete solution for managing the Virtual Display Driver. It handles installation, uninstallation, enabling, disabling, toggling, and status checking of the driver with automatic DevCon version resolution and administrator privilege management.
Features
- Full lifecycle management: Install, uninstall, enable, disable, toggle, and check status
- Interactive menu: Prompts for action selection when run without parameters
- Automatic elevation: Self-elevates to Administrator privileges when needed
- Smart DevCon resolution: Automatically selects the correct DevCon version using nearest-build matching
- JSON output support: Provides machine-readable output for automation
- Automatic cleanup: Removes temporary files after operation completes
- Verbose diagnostics: Detailed logging with
-Verboseflag
Requirements
- Windows 10 version 1809 or later, Windows 11, or Windows Server 2019+
- PowerShell 5.1 or later
- Internet connection (for downloading DevCon and driver files)
- TLS 1.2 support
Parameters
-Action
Specifies the operation to perform. If omitted, the script displays an interactive menu.
Type: StringRequired: No (prompts if not provided)
Valid values:
install, uninstall, enable, disable, toggle, status
-DriverVersion
Specifies which version of the Virtual Display Driver to install. Only used with the install action.
Type: StringRequired: No
Default:
latestExample:
v0.0.50
-Json
Outputs all messages in JSON format for easy parsing by other programs.
Type: SwitchRequired: No
-Silent
Closes the script automatically without prompting for a key press. By default, the script pauses for review.
Type: SwitchRequired: No
-Verbose
Prints detailed diagnostic information and prevents temporary folder deletion for inspection.
Type: Switch (from [CmdletBinding()])Required: No
Usage Examples
Interactive Mode
Run without parameters to get an interactive menu:Install Driver (Latest Version)
Install the latest driver version and pause for review:Install Specific Version
Install a specific driver version:Uninstall Driver (Silent)
Uninstall the driver and close automatically:Enable/Disable Driver
Enable or disable the installed driver:Toggle Driver State
Toggle between enabled and disabled states:Check Driver Status
Check if the driver is installed and its current state:Automation with JSON Output
Get status in JSON format for automated processing:Enable Driver from CMD
Run from Command Prompt or batch file:Verbose Mode for Debugging
Run with detailed logging and preserve temporary files:How It Works
DevCon Version Resolution
The script uses an intelligent nearest-build matching algorithm:- Detects your Windows version and build number
- Downloads the DevCon sources manifest from GitHub
- Maps version names to build numbers
- Selects the DevCon version using this priority:
- Perfect match: Exact build number match
- Older match: Newest version older than or equal to your build (safest fallback)
- Newer match: Oldest version newer than your build (less safe but better than failing)
Self-Elevation Process
If not running as Administrator:- Script detects lack of admin privileges
- Relaunches itself with UAC elevation prompt
- Passes all original parameters to the elevated process
- Original process waits for elevated process to complete
- Returns the exit code from elevated process
Automatic Cleanup
The script uses atry/catch/finally block:
- Creates a unique temporary directory in
$env:TEMP - Downloads DevCon and driver files to this directory
- Always cleans up in the
finallyblock (unless-Verboseis used) - Preserves temp folder in verbose mode for debugging
Actions Detail
Install
- Resolves the correct DevCon version for your OS
- Downloads and runs the DevCon Installer utility
- Downloads the specified driver version from GitHub releases
- Extracts the driver archive
- Uses DevCon to install the driver using the INF file and Hardware ID
Root\MttVDD
Uninstall
- Resolves the correct DevCon version
- Checks if the driver device exists
- Uses DevCon to remove the device by Hardware ID
Root\MttVDD
Enable/Disable/Toggle
- Finds the device by friendly name or Hardware ID
- Uses PowerShell’s
Enable-PnpDeviceorDisable-PnpDevicecmdlets - For toggle: checks current status and performs the opposite action
Status
- Searches for the device by friendly name or Hardware ID
- Returns installation status and current state (enabled/disabled)
- Provides device details (friendly name, instance ID, PnP device ID)
- Outputs in human-readable format or JSON based on
-Jsonflag
Device Detection
The script searches for the device using:- Friendly Name:
IddSampleDriver Device HDRorVirtual Display Driver - Hardware ID (fallback):
Root\MttVDD
Exit Codes
- 0: Operation completed successfully
- 1: Error occurred (see error message for details)
Troubleshooting
Script Won’t Run
If you get an execution policy error, run:DevCon Not Found
The script automatically downloads DevCon. If this fails:- Check your internet connection
- Verify TLS 1.2 is supported on your system
- Run with
-Verboseto see detailed download information
Installation Fails
Common issues:- Secure Boot: May need to be disabled for unsigned test drivers
- Test signing: May need to enable test signing mode
- Network issues: Check GitHub connectivity
- Permissions: Ensure running as Administrator
Check Logs with Verbose Mode
- Show detailed diagnostic messages
- Preserve the temporary directory for inspection
- Display the exact DevCon version selected
- Show all download URLs and file paths
Integration Examples
Task Scheduler
Create a scheduled task to enable the driver at startup:Batch Script
Create a batch file to toggle the driver:Check Status from Another Script
Related Scripts
- changeres-VDD.ps1 - Change virtual display resolution
- toggle-VDD.ps1 - Simple toggle script
- HDRswitch-VDD.ps1 - Toggle HDR mode
- primary-VDD.ps1 - Set as primary display