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:
parent
bc3b87dd76
commit
53be8025fc
2 changed files with 27 additions and 3 deletions
12
RDPSign.bat
Normal file
12
RDPSign.bat
Normal 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
|
||||||
16
RDPSign.ps1
16
RDPSign.ps1
|
|
@ -8,11 +8,20 @@
|
||||||
# "THE SCRIPT IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND..."
|
# "THE SCRIPT IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND..."
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
|
Add-Type -AssemblyName System.Windows.Forms
|
||||||
|
|
||||||
# 1. Configuration
|
# 1. Configuration
|
||||||
$rdpFile = "C:\Users\Desktop\RDPFILENAME.rdp"
|
$rdpFile
|
||||||
$certSubjectName = "CompanyNameIT-RDP"
|
$certSubjectName = "ACO"
|
||||||
$certSubject = "CN=$certSubjectName"
|
$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
|
# 2. Check for existing certificate
|
||||||
Write-Host "Searching for existing certificate: $certSubjectName..." -ForegroundColor Cyan
|
Write-Host "Searching for existing certificate: $certSubjectName..." -ForegroundColor Cyan
|
||||||
$existingCert = Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Subject -eq $certSubject } | Select-Object -First 1
|
$existingCert = Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Subject -eq $certSubject } | Select-Object -First 1
|
||||||
|
|
@ -76,3 +85,6 @@ if (Test-Path $rdpFile) {
|
||||||
} else {
|
} else {
|
||||||
Write-Error "Target RDP file not found at $rdpFile"
|
Write-Error "Target RDP file not found at $rdpFile"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$HOST.UI.RawUI.ReadKey(“NoEcho,IncludeKeyDown”) | OUT-NULL
|
||||||
|
$HOST.UI.RawUI.Flushinputbuffer()
|
||||||
Loading…
Add table
Reference in a new issue