IIS:在PowerShell中显示所有站点和绑定 [英] IIS: Display all sites and bindings in PowerShell
本文介绍了IIS:在PowerShell中显示所有站点和绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在从IIS中记录所有站点以及与该站点相关的绑定.有没有一种简单的方法可以通过PowerShell脚本而不是手动键入IIS来获取此列表?
I am documenting all the sites and binding related to the site from the IIS. Is there an easy way to get this list through a PowerShell script rather than manually typing looking at IIS?
我希望输出是这样的:
Site Bindings
TestSite www.hello.com
www.test.com
JonDoeSite www.johndoe.site
推荐答案
尝试类似的方法以获得所需的格式:
Try something like this to get the format you wanted:
Get-WebBinding | % {
$name = $_.ItemXPath -replace '(?:.*?)name=''([^'']*)(?:.*)', '$1'
New-Object psobject -Property @{
Name = $name
Binding = $_.bindinginformation.Split(":")[-1]
}
} | Group-Object -Property Name |
Format-Table Name, @{n="Bindings";e={$_.Group.Binding -join "`n"}} -Wrap
这篇关于IIS:在PowerShell中显示所有站点和绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文