forked from ge9/IddSampleDriver
-
-
Notifications
You must be signed in to change notification settings - Fork 211
/
Copy pathtoggle-VDD.ps1
21 lines (19 loc) · 1.01 KB
/
toggle-VDD.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# submitted by zjoasan
# 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
}
}
$device = Get-PnpDevice -Class Display -ErrorAction SilentlyContinue | Where-Object { $_.FriendlyName -eq 'IddSampleDriver Device HDR' -or $_.FriendlyName -eq 'Virtual Display Driver' }
if ($device) {
if ($device.Status -eq 'OK') {
Write-Host "Disabling device"; $device | disable-pnpdevice -Confirm:$false
} else {
Write-Host "Enabling device"; $device | enable-pnpdevice -Confirm:$false
}
} else {
Write-Warning "Device not found"
}