Overview
The changeres-VDD.ps1 script provides a simple command-line interface to change the resolution of the Virtual Display Driver. It automatically handles administrator privilege elevation and 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
Parameters
-xres (Position 0)
The horizontal resolution (width) in pixels.
Type: Integer
Required: Yes
Aliases: X, HorizontalResolution
Position: 0 (can be specified without parameter name)
-yres (Position 1)
The vertical resolution (height) in pixels.
Type: Integer
Required: Yes
Aliases: Y, VerticalResolution
Position: 1 (can be specified without parameter name)
Usage Examples
Set 1920x1080 Resolution
# Using parameter names
.\changeres-VDD.ps1 -xres 1920 -yres 1080
# Using aliases
.\changeres-VDD.ps1 -X 1920 -Y 1080
# Using positional parameters (most concise)
.\changeres-VDD.ps1 1920 1080
Common Resolutions
# Full HD (1080p)
.\changeres-VDD.ps1 1920 1080
# 2K / QHD
.\changeres-VDD.ps1 2560 1440
# 4K / UHD
.\changeres-VDD.ps1 3840 2160
# Ultra-wide QHD
.\changeres-VDD.ps1 3440 1440
# 5K
.\changeres-VDD.ps1 5120 2880
# 8K
.\changeres-VDD.ps1 7680 4320
Custom Aspect Ratios
# 16:9 aspect ratio
.\changeres-VDD.ps1 1920 1080
# 21:9 ultra-wide
.\changeres-VDD.ps1 2560 1080
# 32:9 super ultra-wide
.\changeres-VDD.ps1 3840 1080
# 16:10 aspect ratio
.\changeres-VDD.ps1 1920 1200
# 4:3 aspect ratio
.\changeres-VDD.ps1 1600 1200
Portrait Mode
# Portrait orientation (swap width and height)
.\changeres-VDD.ps1 1080 1920
How It Works
1. Self-Elevation
If the script is not running with Administrator privileges:
- Detects the current privilege level
- Relaunches itself with UAC elevation
- Passes all bound parameters to the elevated instance
- Exits the original process
2. Dependency Installation
The script sources set-dependencies.ps1 which:
- Checks if required modules are installed
- Installs
DisplayConfig v1.1.1 from PSGallery if needed
- Installs
MonitorConfig v1.0.3 from PSGallery if needed
- Imports the modules into the current session
- Sets PSGallery repository as trusted
3. Display Identification
Finds the Virtual Display Driver by:
- Using
Get-DisplayInfo to enumerate all displays
- Filtering for displays with name “VDD by MTT”
- Extracting the DisplayId for the target display
4. Resolution Change
Applies the new resolution:
- Uses
Set-DisplayResolution from the DisplayConfig module
- Passes the DisplayId, width, and height parameters
- Windows applies the resolution change immediately
Script Source
Here’s the complete script:
param(
[Parameter(Mandatory, Position=0)]
[Alias("X","HorizontalResolution")]
[int]$xres,
[Parameter(Mandatory, Position=1)]
[Alias("Y","VerticalResolution")]
[int]$yres
)
# 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.BoundParameters.GetEnumerator() | ForEach-Object { $CommandLine += "-$($_.Key):$($_.Value) " }
Start-Process -WorkingDirectory $PSScriptRoot -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" }
# Setting the resolution on the display
Set-DisplayResolution -DisplayId $disp.DisplayId -Width $xres -Height $yres
Troubleshooting
”Display not found” Error
Possible causes:
- Virtual Display Driver is not installed
- Driver is installed but disabled
- Driver display name doesn’t match “VDD by MTT”
Solutions:
# Check if driver is installed and enabled
.\virtual-driver-manager.ps1 -Action status
# Enable the driver if disabled
.\virtual-driver-manager.ps1 -Action enable
# List all displays to verify the name
Get-DisplayInfo | Format-Table DisplayName, DisplayId
Module Installation Fails
Possible causes:
- No internet connection
- PowerShell Gallery not accessible
- Execution policy restrictions
Solutions:
# Check internet connectivity
Test-NetConnection -ComputerName www.powershellgallery.com -Port 443
# Manually install modules
Install-Module -Name DisplayConfig -RequiredVersion 1.1.1 -Scope CurrentUser
Install-Module -Name MonitorConfig -RequiredVersion 1.0.3 -Scope CurrentUser
# Check execution policy
Get-ExecutionPolicy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Resolution Change Doesn’t Apply
Possible causes:
- Resolution not supported by the driver
- Display is in an error state
Solutions:
# Try disabling and re-enabling the driver
.\toggle-VDD.ps1
.\toggle-VDD.ps1
# Check display capabilities
Get-DisplayInfo | Where-Object { $_.DisplayName -eq "VDD by MTT" } | Format-List *
Script Requires set-dependencies.ps1
The script expects set-dependencies.ps1 to be in the same directory. Make sure both files are in the same folder:
Community Scripts/
├── changeres-VDD.ps1
└── set-dependencies.ps1
Automation Examples
Batch File for Quick Resolution Change
Create set-1080p.bat:
@echo off
powershell.exe -ExecutionPolicy Bypass -File "%~dp0changeres-VDD.ps1" 1920 1080
Multiple Resolution Shortcuts
Create different batch files for common resolutions:
REM set-1080p.bat
powershell.exe -ExecutionPolicy Bypass -File "%~dp0changeres-VDD.ps1" 1920 1080
REM set-1440p.bat
powershell.exe -ExecutionPolicy Bypass -File "%~dp0changeres-VDD.ps1" 2560 1440
REM set-4k.bat
powershell.exe -ExecutionPolicy Bypass -File "%~dp0changeres-VDD.ps1" 3840 2160
Call from Another PowerShell Script
# Change to 4K resolution
& "$PSScriptRoot\changeres-VDD.ps1" -xres 3840 -yres 2160
# Or using positional parameters
& "$PSScriptRoot\changeres-VDD.ps1" 3840 2160
Resolution Limits
The Virtual Display Driver supports a wide range of resolutions. Common limits:
- Minimum: Typically 640x480 or higher
- Maximum: Depends on driver configuration (can support 8K and beyond)
- Aspect ratios: Any custom aspect ratio is supported
Test your specific configuration to determine actual limits.