diff --git a/RDPSign.bat b/RDPSign.bat new file mode 100644 index 0000000..5e7315b --- /dev/null +++ b/RDPSign.bat @@ -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 \ No newline at end of file diff --git a/RDPSign.ps1 b/RDPSign.ps1 index 6ee1c44..1c031bf 100644 --- a/RDPSign.ps1 +++ b/RDPSign.ps1 @@ -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 @@ -75,4 +84,7 @@ if (Test-Path $rdpFile) { Write-Host "Success! RDP file is ready for use." -ForegroundColor Green } else { Write-Error "Target RDP file not found at $rdpFile" -} \ No newline at end of file +} + +$HOST.UI.RawUI.ReadKey(“NoEcho,IncludeKeyDown”) | OUT-NULL +$HOST.UI.RawUI.Flushinputbuffer() \ No newline at end of file