且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

IIS:在PowerShell中显示所有站点和绑定

更新时间:2023-11-02 23:45:04

尝试类似的方法以获得所需的格式:

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