Compare commits

..

No commits in common. "main" and "release" have entirely different histories.

2 changed files with 14 additions and 24 deletions

View file

@ -2,5 +2,11 @@
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 -Command "Start-Process PowerShell -ArgumentList '-ExecutionPolicy Bypass -File ""%~dp0RDPSign.ps1""' -Verb RunAs"
powershell.exe -executionpolicy bypass -file %drivepath%\RDPSign.ps1

View file

@ -23,21 +23,14 @@ if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent
Write-Host "-------------------------------------------" -ForegroundColor Blue
Write-Host "|Developed by Tanner Van Teeffelen |" -ForegroundColor Blue
Write-Host "|Copyright ACO Services Inc. 2026 |" -ForegroundColor Blue
Write-Host "|Copyright ACO Services Inc. 2021 |" -ForegroundColor Blue
Write-Host "|Based on MIT-licensed work by IanVanLier |" -ForegroundColor Blue
Write-Host "-------------------------------------------`n" -ForegroundColor Blue
# 1. Get existing .rdp file.
# 1. Configuration
$rdpFile
$certSubjectName
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 "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
$HOST.UI.RawUI.ReadKey(NoEcho,IncludeKeyDown) | OUT-NULL
$HOST.UI.RawUI.Flushinputbuffer()
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog
$FileBrowser.Filter = "RDP Files (*.rdp)|*.rdp|All Files (*.*)|*.*"
$FileBrowser.DefaultExt = "rdp"
@ -59,17 +52,10 @@ if ([IO.Path]::GetExtension($rdpFile) -ne ".rdp") {
exit 3
}
# 2. Set the certificate name.
$certSubjectName = Read-Host "Please type in your desired certificate subject name. Leave blank to use hostname"
if ([string]::IsNullOrWhiteSpace($certSubjectName)) {
$certSubjectName = $env:COMPUTERNAME
}
$certSubjectName = Read-Host "Please type in your desired certificate subject name (e.g. 'CompanyNameIT-RDP')"
$certSubject = "CN=$certSubjectName"
# 3. Check for existing certificate
# 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
@ -123,17 +109,15 @@ if ($existingCert) {
Write-Host "New certificate created and trusted." -ForegroundColor Green
}
# 4. Sign the RDP File
# 3. Sign the RDP File
if (Test-Path $rdpFile) {
Write-Host "Signing RDP file: $rdpFile" -ForegroundColor Cyan
# Signing with /sha256 to match modern security standards
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 {
Write-Error "Target RDP file not found at $rdpFile" -ForegroundColor Red
Write-Error "Target RDP file not found at $rdpFile"
}
Write-Host "Press any key to exit." -ForegroundColor Green
$HOST.UI.RawUI.ReadKey(NoEcho,IncludeKeyDown) | OUT-NULL
$HOST.UI.RawUI.Flushinputbuffer()