forked from ge9/IddSampleDriver
-
-
Notifications
You must be signed in to change notification settings - Fork 366
Expand file tree
/
Copy pathrotate-VDD.ps1
More file actions
42 lines (35 loc) · 1.29 KB
/
rotate-VDD.ps1
File metadata and controls
42 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
param(
[Parameter(Mandatory, Position = 0)]
[ValidateSet(90, 180, 270)]
[int]$rotate
)
# 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"
switch ($rotate) {
90 {
$degree = "Rotate90"
continue
}
180 {
$degree = "Rotate180"
continue
}
270 {
$degree = "Rotate270"
continue
}
default { Write-Error "Invalid rotation angle(valid 90,180,270)."; break }
}
# Getting the correct display
$disp = Get-DisplayInfo | Where-Object { $_.DisplayName -eq "VDD by MTT" }
# Setting the resolution on the correct display.
Set-DisplayRotation -DisplayId $disp.DisplayId -Rotation $degree