PowerShell 获取所有 IIS 站点绑定
要在 PowerShell 中获取所有 IIS 站点绑定,请使用 `Get-IISSiteBinding` cmdlet。 Get-IISSiteBinding 命令获取有关网站绑定、其当前状态和其他关键信息的信息。
以下语法是在 PowerShell 中使用 Get-IISSiteBinding cmdlet 获取网站信息。
Get-IISSiteBinding
[-Name] <String>
[[-BindingInformation] <String>]
[[-Protocol] <String>]
[<CommonParameters>]在本文中,我们将讨论如何使用 Powershell 中的 Get-IISSiteBinding 命令和 Get-ChildItem iis:\sites 命令获取网站的所有 IIS 绑定。
如何获取 IIS 网站的所有绑定
要获取 IIS 网站的所有绑定,请使用 PowerShell 中的 Get-IISSiteBinding cmdlet。 Name 参数指定获取所有绑定的网站名称。
Get-IISSiteBinding -Name 'Default Web Site'在上面的 PowerShell 脚本中,Get-IISSiteBinding 命令获取“默认网站”的所有绑定。
下面给出了上述检索所有 iis 绑定的 PowerShell 脚本的输出。
使用 Get-ChildItem iis:\sites 获取所有 IIS 绑定
您可以在 PowerShell 中使用 Get-ChildItem cmdlet,该 cmdlet 使用 iis:\sites PSDrive 并获取所有 IIS 网站绑定。
Get-ChildItem -Path IIS:\Sites 此命令获取有关 IIS 服务器中所有网站和应用程序的所有绑定的所有配置信息。
上述 PowerShell 脚本的输出如下所示。
PS C:\> Get-ChildItem -Path IIS:\Sites
Name ID State Physical Path Bindings
---- -- ----- ------------- --------
Default Web Site 1 Started %SystemDrive%\inetpub\wwwroot http *:80:
net.tcp 808:*
net.msmq localhost
msmq.formatname localhost
net.pipe *
HMI 2 Started C:\inetpub\wwwroot\TEST HMI http *:4001:
HMITest 3 Started C:\inetpub\wwwroot\charity http *:3500:
https *:443: sslFlags=0结论
我希望上述有关如何使用 PowerShell Get-IISSiteBinding cmdlet 获取所有 IIS 站点绑定的文章对您有所帮助。
您可以在 ShellGeek 主页上找到有关 PowerShell Active Directory 命令和 PowerShell 基础知识的更多主题。
