Skip to content

Commit 69359ec

Browse files
authored
Module_install.bat and get_disp_num.p1 (DISPLAY#)
Since dep_fix.ps1 seem less then reliable, I've created a bat file that installs the needed powershell modules. It needs admin privs. to install to all users on the machine. I'm planning on running this .bat during the installer in case the user choose to install the scripts. The get_disp_num.ps1 is for those users depending on \\\\.\\DISPLAY number to get the right display for their scripting needs in their "automation"
1 parent c87b0c4 commit 69359ec

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

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)