Skip to content

Commit 8686233

Browse files
Add SSTP and VMWare Horizon scripting examples
1 parent b9b65a5 commit 8686233

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

docs/intro.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Note: this documentation is a work-in-progress and applies to v4.0 and higher.
1515
- [DNS Validation (dns-01)](dns-validation.md)
1616
- [HTTP Validation (http-01)](http-validation.md)
1717
- [Deployment](deployment.md)
18+
- [Scripting](script-hooks.md) e.g. custom deployment for Exchange, RDP Gateway or other services
1819
- [Certificate Renewal](renewals.md)
1920
- Limitations
2021
- [SSL on Windows](ssl-windows.md)

docs/script-hooks.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ id: script-hooks
33
title: Scripting Hooks
44
---
55

6-
# Request Script Hooks
6+
# Scripting
77

8-
Certify is extensible via PowerShell scripts which can be configured to run before or after the Certificate Request. The scripts are provided a parameter `$result` which contains the status and details of the managed certificate being requested. You can execute any commands including creating new processes, or using other command line tools.
8+
Certify is extensible via PowerShell scripts which can be configured to run before or after the Certificate Request (check `Show Advanced Options` and open the `Scripting` tab). The scripts are provided a parameter `$result` which contains the status and details of the managed certificate being requested. You can execute any commands including creating new processes, or using other command line tools.
99

1010
A common use for script hooks is to use your new certificate for services other than IIS websites, such as Microsoft Exchange, RDP Gateway, FTP servers and other services.
1111

@@ -137,6 +137,47 @@ ps64 -args $result -command {
137137
}
138138
```
139139

140+
141+
### Example: Update VMWare Horizon certificate
142+
This example removes any previous certificate with the same FriendlyName (`vdm`) then renames the Friendly Name property of the new certificate to `vmd`. It then restarts the `wstunnel` service.
143+
144+
```PowerShell
145+
param($result)
146+
147+
if ($result.IsSuccess) {
148+
149+
$thumbprint = $result.ManagedItem.CertificateThumbprintHash # e.g. 2c127d49b4f63d947dd7b91750c9e57751eced0c
150+
151+
# remove the old cert (by Friendly Name 'vdm') to avoid duplication, if it exists
152+
Get-ChildItem -Path cert:\LocalMachine\My | Where {$_.FriendlyName.Equals("vdm")} | Remove-Item
153+
154+
# rename our new certificate
155+
$cert = Get-ChildItem -Path cert:\LocalMachine\My\$thumbprint
156+
157+
$cert.FriendlyName ="vdm"
158+
159+
# restart the wstunnel service to apply certificate
160+
Restart-Service wstunnel -Force -ErrorAction Stop
161+
}
162+
163+
```
164+
165+
166+
#### Example: Update certificate for SSTP VPN
167+
```PowerShell
168+
169+
170+
param($result)
171+
172+
# Store certificate in variable
173+
$cert = Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object {$_.Thumbprint -match $result.ManagedItem.CertificateThumbprintHash}
174+
175+
# Stop RRAS, set cert, start RRAS
176+
Import-Module RemoteAccess
177+
Stop-Service RemoteAccess
178+
Set-RemoteAccess -SslCertificate $cert
179+
Start-Service RemoteAccess
180+
```
140181
## Troubleshooting
141182

142183

0 commit comments

Comments
 (0)