Complete Active Directory teaching environment based on dockurr/windows: - Windows Server domain controller, Windows 11 client, Debian 12 client - docker-compose orchestration, env-driven configuration - Bilingual documentation (FR + EN) for students - Dual approach (GUI + PowerShell) in every procedure - Instructor course plan and reference scripts - RDP launcher scripts for Linux, macOS and Windows Made by AcadéNice - https://acadenice.fr/
43 lines
1.2 KiB
PowerShell
43 lines
1.2 KiB
PowerShell
# Ouvre une session RDP sur le contrôleur de domaine (DC01).
|
|
# Fait par AcadéNice - https://acadenice.fr/
|
|
|
|
param(
|
|
[string]$RdpHost = "127.0.0.1",
|
|
[int]$Port = 3389,
|
|
[string]$User = "Administrator",
|
|
[string]$Domain = "CORP",
|
|
[string]$Password = "AdminP@ss!2026"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$envFile = Join-Path $PSScriptRoot "..\.env"
|
|
if (Test-Path $envFile) {
|
|
Get-Content $envFile | Where-Object { $_ -match '^([A-Z_]+)=(.*)$' } | ForEach-Object {
|
|
$k = $Matches[1]; $v = $Matches[2].Trim('"').Trim("'")
|
|
switch ($k) {
|
|
"DC_RDP_PORT" { $Port = [int]$v }
|
|
"AD_DOMAIN_NETBIOS" { $Domain = $v }
|
|
"AD_ADMIN_PASSWORD" { $Password = $v }
|
|
}
|
|
}
|
|
}
|
|
|
|
cmdkey /generic:"TERMSRV/$RdpHost" /user:"$Domain\$User" /pass:"$Password" | Out-Null
|
|
|
|
$sharedPath = (Resolve-Path "$PSScriptRoot\..\shared").Path
|
|
$rdpFile = Join-Path $env:TEMP "lab_ad_dc.rdp"
|
|
|
|
@"
|
|
full address:s:${RdpHost}:${Port}
|
|
username:s:${Domain}\${User}
|
|
redirectclipboard:i:1
|
|
redirectdrives:i:1
|
|
drivestoredirect:s:${sharedPath}
|
|
desktopwidth:i:1600
|
|
desktopheight:i:900
|
|
smart sizing:i:1
|
|
authentication level:i:0
|
|
"@ | Out-File -FilePath $rdpFile -Encoding ASCII -Force
|
|
|
|
Start-Process mstsc -ArgumentList "`"$rdpFile`""
|