Script to enroll and replace certificate for your Horizon Connection Server
top of page
Zoeken
  • Foto van schrijverEdwin de Bruin

Script to enroll and replace certificate for your Horizon Connection Server

Found this script i created when building the lab in my archives... perhaps it will help someone. Enjoy!


# Edwin de Bruin


$CServer=”MS-SUB-CA-01” #Enter your CA Server

$templatename=”Horizon_CS” #template used for your horizon server



$Domain=Get-WMIObject Win32_ComputerSystem| Select-Object -ExpandProperty Domain

$Domain="$Domain".ToLower()

$FQDN=$env:COMPUTERNAME+'.'+$domain


$fqdn=([System.Net.Dns]::GetHostByName(($env:computerName))).Hostname

$subjectname='CN='+$FQDN


#rename Friendly name Currentcert

$cert = Get-ChildItem -Path Cert:\LocalMachine\My | where{ $_.FriendlyName –eq 'vdm'}

$Thumbprint = $cert.Thumbprint

(Get-ChildItem -Path Cert:\LocalMachine\My\$Thumbprint).FriendlyName = 'oldvdm'


#get new certificate


Get-Certificate -URL "ldap:///CN=$CServer" -SubjectName "$subjectname" -Template Horizon_CS -CertStoreLocation Cert:\LocalMachine\My


#rename Friendly name new cert

$cert = Get-ChildItem -Path Cert:\LocalMachine\My | where{ $_.Subject -eq "$subjectname" -and $_.FriendlyName -ne "oldvdm"}

$Thumbprint = $cert.Thumbprint

(Get-ChildItem -Path Cert:\LocalMachine\My\$Thumbprint).FriendlyName = 'vdm'


restart-service wsbroker


52 weergaven0 opmerkingen
Post: Blog2_Post
bottom of page