⚠️ 網站服務遷移公告 (System Alert)
本篇文章已搬移至新站 Blogger!
為了提供無廣告、更流暢的閱讀體驗,請前往新站閱讀。
🚀 點此立即前往新站閱讀

🚀 新版發布:IIS SSL 自動化腳本 V6 (完整版)

您目前觀看的是舊版本教學。為了提升安全性與自動化穩定度,我已釋出最新的 V6 完整版,整合了 AES 加密與自動解密流程。

👉 點此前往:[PowerShell] IIS SSL 憑證自動更新全攻略 (V6)

(包含完整原始碼、加密設定與排程教學)


多台伺服器要更新
想偷懶只好使用 Powershell 來偷懶

Updating IIS certificates with powershell

 

$OLDCertificateThumbprint = "123456789abcdefgh1a2b3c4d5e6f7g8h9a1a1a1"
$NEWCertificateThumbprint = "7a3b5a1g1a6a2j2a262a3343a333a5a64a4a4a4a"

#Show bindings where the old certificate is in use
Get-WebBinding | Where-Object { $_.certificateHash -eq $OLDCertificateThumbprint} | Format-Table

#Select bindings where the old certificate is in use and attach the new certificate
Get-WebBinding | Where-Object { $_.certificateHash -eq $OLDCertificateThumbprint} | ForEach-Object {
        Write-Host "Working on"  $_ 
        $_.RemoveSslCertificate()
        $_.AddSslCertificate($NEWCertificateThumbprint, 'My')
        }

#Show bindings where the new certificate is in use
Get-WebBinding | Where-Object { $_.certificateHash -eq $NEWCertificateThumbprint}

 

GOOGLE 測試貌似可以用

參考連結 : 

Updating IIS certificates with powershell (lachlanbarclay.net)
powershell - Update all bindings in IIS to replace an expiring SSL Certificate with a new one - Stack Overflow
Simple PowerShell Script To Update SSL Certificate Bindings On All IIS Sites ~ Bauer-Power Media (archive.org)
IIS - Install SSL Certificate via Shell or Prompt (xolphin.com)

 

創作者介紹
創作者 sungshu手札筆記本 的頭像
sungshu

sungshu手札筆記本

sungshu 發表在 痞客邦 留言(1) 人氣( 46 )