To get all IIS site bindings in the PowerShell, use the `Get-IISSiteBinding
` cmdlet. The Get-IISSiteBinding command gets information about website bindings, their current status, and other key information.
The following syntax is to use the Get-IISSiteBinding cmdlet in PowerShell to get website information.
Get-IISSiteBinding [-Name] <String> [[-BindingInformation] <String>] [[-Protocol] <String>] [<CommonParameters>]
In this article, we will discuss how to get all IIS bindins for websites using the Get-IISSiteBinding command and the Get-ChildItem iis:\sites command in Powershell.
How to Get All Bindings of an IIS Website
To get all bindings of an IIS website, use the Get-IISSiteBinding cmdlet in PowerShell. The Name
parameter specifies the name of the website to get all bindings.
Get-IISSiteBinding -Name 'Default Web Site'
In the above PowerShell script, the Get-IISSiteBinding
command gets all bindings of the ‘Default Web Site‘.
The output of the above PowerShell script that retrieves all iis bindings is given below.
Using the Get-ChildItem iis:\sites to Get All IIS Bindings
You can use the Get-ChildItem
cmdlet in PowerShell which uses the iis:\sites
PSDrive and gets all IIS website bindings.
Get-ChildItem -Path IIS:\Sites
This command gets all configuration information about all bindings for all websites and applications in the IIS server.
The output of the above PowerShell script is given below.
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
Conclusion
I hope the above article on how to get all IIS site bindings using the PowerShell Get-IISSiteBinding cmdlet is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.