File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments