auto-turning/installSSL.ps1

31 lines
1.7 KiB
PowerShell

# ==========================================
# 📥 ШАГ 1: Установка сертификата в систему
# ==========================================
# Путь к файлу PFX
$PfxPath = "C:\edo\Help-D_RDP.pfx"
$PfxPassword = "sj032ssa"
Write-Host "⏳ Импорт сертификата..." -ForegroundColor Cyan
try {
$SecurePass = ConvertTo-SecureString -String $PfxPassword -AsPlainText -Force
# 1. Доверенные корневые центры (Доверие цепочке)
Import-PfxCertificate -FilePath $PfxPath -CertStoreLocation Cert:\LocalMachine\Root -Password $SecurePass | Out-Null
# 2. Доверенные издатели (Убирает предупреждение "Неизвестный издатель")
Import-PfxCertificate -FilePath $PfxPath -CertStoreLocation Cert:\LocalMachine\TrustedPublisher -Password $SecurePass | Out-Null
# 3. Личное хранилище (Доступ к приватному ключу для подписи)
$Cert = Import-PfxCertificate -FilePath $PfxPath -CertStoreLocation Cert:\LocalMachine\My -Password $SecurePass -Exportable
$Thumb = $Cert.Thumbprint
Write-Host "✅ Сертификат успешно установлен." -ForegroundColor Green
Write-Host "📋 Скопируйте этот отпечаток для Шага 2:" -ForegroundColor Yellow
Write-Host "------------------------------------------------"
Write-Host "$Thumb" -ForegroundColor White -BackgroundColor DarkBlue
Write-Host "------------------------------------------------"
} catch {
Write-Error "❌ Ошибка установки: $_"
}