iis - 在 PowerShell 中显示所有站点和绑定(bind)

标签 iis powershell powershell-3.0 iis-8

我正在记录 IIS 中的所有站点以及与该站点相关的绑定(bind)。有没有一种简单的方法可以通过 PowerShell 脚本获取此列表,而不是手动键入查看 IIS?

我希望输出是这样的:

Site                          Bindings
TestSite                     www.hello.com
                             www.test.com
JonDoeSite                   www.johndoe.site

最佳答案

试试这个:

Import-Module Webadministration
Get-ChildItem -Path IIS:\Sites

它应该返回如下所示的内容:

Name             ID   State      Physical Path                  Bindings
----             --   -----      -------------                  --------
ChristophersWeb 22   Started    C:\temp             http *:8080:ChristophersWebsite.ChDom.com

从这里您可以优化结果,但要小心。指向 select 语句的管道不会为您提供所需的内容。根据您的要求,我将构建一个自定义对象或哈希表。

关于iis - 在 PowerShell 中显示所有站点和绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15528492/

相关文章:

amazon-web-services - AWS 负载均衡器 IIS

asp.net - 每个 ASP.NET 应用程序实例是否都有持久存储?

asp.net - 更改为 Asp.net 4.0 得到 "The page cannot be found"

wcf - 队列的 Web 服务 wcf 性能计数器

html - DotAll 和多行正则表达式

powershell - 在 PowerShell 中如何替换回车

powershell - 是否可以在 powershell 3.0 的 Invoke-WebRequest 中使用 document.querySelector?

powershell - 通过Powershell进行SSIS项目部署-将项目参数配置为使用Env变量

powershell - 运行 Get-ADGroupMember 时出现延迟

powershell - 如何检测脚本是点源的,还是使用 powershell v2+ 作为模块的一部分加载的?