Added in pop-up box to select .rdp file location. Added in buffer at end to allow user to read results. Added in .bat file for ease of use.

This commit is contained in:
Tanner van Teeffelen 2026-05-08 15:39:34 -04:00
parent bc3b87dd76
commit 53be8025fc
2 changed files with 27 additions and 3 deletions

12
RDPSign.bat Normal file
View file

@ -0,0 +1,12 @@
@ECHO OFF
rem Developed by Tanner Van Teeffelen
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.
powershell.exe -executionpolicy bypass -file %drivepath%\RDPSign.ps1

View file

@ -8,11 +8,20 @@
# "THE SCRIPT IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND..."
# ==============================================================================
Add-Type -AssemblyName System.Windows.Forms
# 1. Configuration
$rdpFile = "C:\Users\Desktop\RDPFILENAME.rdp"
$certSubjectName = "CompanyNameIT-RDP"
$rdpFile
$certSubjectName = "ACO"
$certSubject = "CN=$certSubjectName"
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog
$FileBrowser.Title = "Select an RDP file."
if ($FileBrowser.ShowDialog() -eq "OK") {
$rdpFile = $FileBrowser.FileName
}
# 2. Check for existing certificate
Write-Host "Searching for existing certificate: $certSubjectName..." -ForegroundColor Cyan
$existingCert = Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Subject -eq $certSubject } | Select-Object -First 1
@ -76,3 +85,6 @@ if (Test-Path $rdpFile) {
} else {
Write-Error "Target RDP file not found at $rdpFile"
}
$HOST.UI.RawUI.ReadKey(NoEcho,IncludeKeyDown) | OUT-NULL
$HOST.UI.RawUI.Flushinputbuffer()