Resolve Desktop path dynamically for current user
Uses Windows Known Folder API so the script works on any workstation without modifying user paths.
This commit is contained in:
parent
bc3b87dd76
commit
8e75aeba7e
1 changed files with 6 additions and 2 deletions
|
|
@ -9,7 +9,11 @@
|
|||
# ==============================================================================
|
||||
|
||||
# 1. Configuration
|
||||
$rdpFile = "C:\Users\Desktop\RDPFILENAME.rdp"
|
||||
|
||||
# Resolve the current signed in user's Desktop path
|
||||
$desktopPath = [Environment]::GetFolderPath('Desktop')
|
||||
$rdpFile = Join-Path $desktopPath 'Azure\asgc-data.rdp'
|
||||
|
||||
$certSubjectName = "CompanyNameIT-RDP"
|
||||
$certSubject = "CN=$certSubjectName"
|
||||
|
||||
|
|
@ -75,4 +79,4 @@ 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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue