Skip to content

Commit 44e1999

Browse files
Merge pull request #281 from zjoasan/master
Module_install.bat and get_disp_num.p1 (DISPLAY#)
2 parents c87b0c4 + 69359ec commit 44e1999

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Community Scripts/get_disp_num.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Get-Monitor | Where-Object { $_.InstanceName -like '*MTT1337*' } | Sort-Object { [int] (($_.InstanceName -match 'UID(\d+)') -and $Matches[1]) } | Select-Object -First 1 -ExpandProperty LogicalDisplay | select-object Devicename
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@echo off
2+
3+
:: Use PowerShell for elevation check and execution
4+
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
5+
"$elevated = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator');" ^
6+
"if (-not $elevated) {" ^
7+
"$CommandLine = '-File \"' + $MyInvocation.MyCommand.Path + '\" ' + $MyInvocation.UnboundArguments;" ^
8+
"Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine;" ^
9+
"Exit" ^
10+
"} else {" ^
11+
"Install-Module -Name DisplayConfig -Scope AllUsers -Force -AllowClobber;" ^
12+
"Install-Module -Name MonitorConfig -Scope AllUsers -Force -AllowClobber;" ^
13+
"if ($?) {" ^
14+
"Write-Output 'Modules installed successfully.'" ^
15+
"} else {" ^
16+
"Write-Output 'An error occurred while installing the modules.'" ^
17+
"}" ^
18+
"}"
19+
20+
pause

0 commit comments

Comments
 (0)