mirror of
https://github.com/VirtualDrivers/Virtual-Display-Driver.git
synced 2026-10-22 06:32:32 -05:00
- FIX: selecting display - FEAT: add params with validations where necessary. - FEAT: add dependency checking
27 lines
1.1 KiB
PowerShell
27 lines
1.1 KiB
PowerShell
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 |