[英]How do I get the website name when from a WebBinding using Powershell?
So I'm writing a Powershell script to validate all HTTPS bindings of all websites actually have a respective SSL binding.所以我正在编写一个 Powershell 脚本来验证所有网站的所有 HTTPS 绑定实际上都具有各自的 SSL 绑定。 I know this sounds pointless, becasue the IIS Management interface already validates this when trying to save such a binding, but trust me when I say this isn't always the case when you have a mix of bindings in a shared IIS configuration, where some bindings use certificates from the CCS and some use locally installed certificates.
我知道这听起来毫无意义,因为 IIS 管理界面在尝试保存此类绑定时已经对此进行了验证,但是请相信我,当您在共享 IIS 配置中混合绑定时,请相信我说情况并非总是如此,其中一些绑定使用来自 CCS 的证书,有些使用本地安装的证书。
I've already written a script that can provide me with a list of website bindings, that don't have a corresponding SSL binding.我已经编写了一个脚本,可以为我提供网站绑定列表,但没有相应的 SSL 绑定。 This list is compiled using the
Get-WebBinding
scriptlet.此列表是使用
Get-WebBinding
scriptlet 编译的。
I'm probably overlooking something very simple, but does anybody know how to determine the website name from just a WebBinding?我可能忽略了一些非常简单的事情,但是有人知道如何仅从 WebBinding 确定网站名称吗?
Never mind, I found a way to do this afterall:没关系,我找到了一种方法来做到这一点:
function GetWebsiteName() {
param (
[Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] $binding
)
$binding.ItemXPath -replace '(?:.*?)name=''([^'']*)(?:.*)', '$1'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.