BindingElement Class [IIS 7 and higher]

Represents a binding element for a Web site.

Syntax

class BindingElement : CollectionElement

Methods

This class contains no methods.

Properties

The following table lists the properties exposed by the BindingElement class.

Name

Description

BindingInformation

A nonempty read/write string value with three colon-delimited fields that specify binding information for a Web site. The first field is a specific IP address or an asterisk (an asterisk specifies all unassigned IP addresses). The second field is the port number; the default is 80. The third field is an optional host header.

Protocol

A required unique nonempty read/write string value that specifies the protocol that the site binding uses. The default is "HTTP". The key property.

Subclasses

This class contains no subclasses.

Remarks

Instances of this class are contained in the Bindings array property of the Site class.

Example

The following example retrieves the bindings for all of the sites on a Web server.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get all Web site instances.
Set oSites = oWebAdmin.InstancesOf("Site")

' Display the name of each site and its bindings.
For Each oSite In oSites

    WScript.Echo oSite.Name

    For Each objItem in oSite.Bindings
        Wscript.Echo "Binding Info: " & objItem.BindingInformation
        Wscript.Echo "Protocol: " & objItem.Protocol
    Next
    WScript.Echo
Next

Inheritance Hierarchy

CollectionElement

   BindingElement

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

CollectionElement Class [IIS 7 and higher]

SSLBinding Class [IIS 7 and higher]

Site Class [IIS 7 and higher]