湖北三类大学,雅安芦山县委书记,天使的翅膀伴奏
最近发现我们开发环境的 iis 上的 ssl 证书过期了,为了后面方便维护和更新,搞了一个 powershell 脚本,以后要更新的时候直接跑一下脚本就可以了,所以有了这篇文章
更新过程:
完整的更新脚本如下:
$hostname = "xxx.com" $pfxcertpath = "c:\backup\xxxxx.pfx" $pfxcertpwdpath = "c:\backup\pfx-password.txt" $certimportpwd = get-content $pfxcertpwdpath | convertto-securestring -asplaintext -force # try remove before ssl certs get-childitem "cert:\localmachine\my" | where-object { $_.subject -like "*$hostname*" } | remove-item # import new ssl $importedcert = import-pfxcertificate -filepath $pfxcertpath -certstorelocation "cert:\localmachine\my" -p $certimportpwd $certhash = $importedcert.thumbprint # remove sslcert binding netsh http delete sslcert hostnameport="${hostname}:443" # add new sslcert binding $guid = [guid]::newguid().tostring("b") netsh http add sslcert hostnameport="${hostname}:443" certhash=$certhash certstorename=my appid="$guid"
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
新补丁让Windows 10出现死机、卡顿等 微软坐不住称正解决
Ubuntu 20.04 LTS进驻Windows子系统:只能用3年
ThinkPad正式加入:预装Linux发行版而非Win10的PC越来越多了
最新版Android 11推送!谷歌Pixel 5被曝光:支持反向充电
高度致敬Windows!开源优麒麟20.04 LTS发布:支持5年
电脑小知识:Windows 10是用什么语言写的?到底有多少行代码?
Win10 5月更新准正式版:微软引入大量新功能 系统响应速度快
Windows 10新预览版19613推送:修复任务栏图标显示异常BUG
Windows AD 报错解决:UAC File Virtualization服务启动失败 此驱动程序被阻止加载
网友评论