在PowerShell中显示所有站点和绑定 [英] Display all sites and bindings in powershell

查看:166
本文介绍了在PowerShell中显示所有站点和绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从IIS记录与网站相关的所有网站和绑定。想知道是否有一种简单的方法通过powershell脚本获取此列表而不是手动键入查看IIS?

I am documenting all the sites and binding related to the site from the IIS. Wondering if there is an easy way to get this list through 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

这篇关于在PowerShell中显示所有站点和绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆