Modified .bat file to automatically open the Powershell script as admin.

This commit is contained in:
Tanner van Teeffelen 2026-05-11 12:40:19 -04:00
parent c56835cf8c
commit e6ddc0797d
Notes: Tanner Van Teeffelen 2026-05-11 12:40:59 -04:00
Also fixed a minor grammatical mistake and added in a color for an error.
2 changed files with 3 additions and 9 deletions

View file

@ -2,11 +2,5 @@
rem Developed by Tanner Van Teeffelen rem Developed by Tanner Van Teeffelen
rem Copyright ACO Services Inc. 2026 rem Copyright ACO Services Inc. 2026
rem Sets path equal to the location of the running script.
SET drivepath=%~dp0
rem Removes extra slash at the end of the drive path.
%drivepath:~0,-1%
rem Runs installer with the ExecutionPolicy set to bypass. rem Runs installer with the ExecutionPolicy set to bypass.
powershell.exe -executionpolicy bypass -file %drivepath%\RDPSign.ps1 powershell.exe -Command "Start-Process PowerShell -ArgumentList '-ExecutionPolicy Bypass -File ""%~dp0RDPSign.ps1""' -Verb RunAs"

View file

@ -31,7 +31,7 @@ Write-Host "-------------------------------------------`n" -ForegroundColor Blue
$rdpFile $rdpFile
$certSubjectName $certSubjectName
Write-Host "Before proceeding, please ensure that the .RDP file you select has the permissions you want" -ForegroundColor Green Write-Host "Before proceeding, please ensure that the .RDP file you select has the permissions you want." -ForegroundColor Green
Write-Host "This includes redirected printers, drives, and clipboard." -Foreground Green Write-Host "This includes redirected printers, drives, and clipboard." -Foreground Green
Write-Host "If you make a change to the .RDP file, please run this program again after making your changes.`n" -ForegroundColor Red Write-Host "If you make a change to the .RDP file, please run this program again after making your changes.`n" -ForegroundColor Red
Write-Host "Press any key to continue.`n" -ForegroundColor Green Write-Host "Press any key to continue.`n" -ForegroundColor Green
@ -130,7 +130,7 @@ if (Test-Path $rdpFile) {
rdpsign.exe /sha256 $thumbprint "$rdpFile" rdpsign.exe /sha256 $thumbprint "$rdpFile"
Write-Host "Success! RDP file is ready for use" -ForegroundColor Green Write-Host "Success! RDP file is ready for use" -ForegroundColor Green
} else { } else {
Write-Error "Target RDP file not found at $rdpFile" Write-Error "Target RDP file not found at $rdpFile" -ForegroundColor Red
} }
Write-Host "Press any key to exit." -ForegroundColor Green Write-Host "Press any key to exit." -ForegroundColor Green