File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/Certify.Shared.Extensions/Scripts/Common Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 77param ($result )
88
99# Apply certificate
10- wmic / namespace:\\root\cimv2\TerminalServices PATH Win32_TSGeneralSetting Set SSLCertificateSHA1Hash= " $ ( $result.ManagedItem.CertificateThumbprintHash ) "
10+ if (Get-Command wmic - errorAction SilentlyContinue)
11+ {
12+ # Beginning with Windows Server 2025, WMIC is available as a feature on demand.
13+ wmic / namespace:\\root\cimv2\TerminalServices PATH Win32_TSGeneralSetting Set SSLCertificateSHA1Hash= " $ ( $result.ManagedItem.CertificateThumbprintHash ) "
14+ }
15+ else
16+ {
17+ # For new development, use the CIM cmdlets instead.
18+ $instance = Get-CimInstance - ClassName Win32_TSGeneralSetting - Namespace root/ cimv2/ TerminalServices
19+ Set-CimInstance - InputObject $instance - Property @ {SSLCertificateSHA1Hash = $result.ManagedItem.CertificateThumbprintHash }
20+ }
You can’t perform that action at this time.
0 commit comments