ModulesSection Class

Represents the modules section in a configuration file.

Syntax

class ModulesSection : ConfigurationSectionWithCollection  

Methods

The following table lists the methods exposed by the ModulesSection class.

Name Description
Add (Inherited from ConfigurationSectionWithCollection.)
Clear (Inherited from ConfigurationSectionWithCollection.)
Get (Inherited from ConfigurationSectionWithCollection.)
GetAllowDefinition (Inherited from ConfigurationSection.)
GetAllowLocation (Inherited from ConfigurationSection.)
Remove (Inherited from ConfigurationSectionWithCollection.)
RevertToParent (Inherited from ConfigurationSection.)
SetAllowDefinition (Inherited from ConfigurationSection.)
SetAllowLocation (Inherited from ConfigurationSection.)

Properties

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

Name Description
Location (Inherited from ConfigurationSection.) A key property.
Modules An array of read/write ModuleAction values.
Path (Inherited from ConfigurationSection.) A key property.
RunAllManagedModulesForAllRequests A read/write boolean value. true if all managed modules are run for every request; otherwise, false. The default is false.
SectionInformation (Inherited from ConfigurationSection.)

Subclasses

This class contains no subclasses.

Remarks

This class contains global modules that are enabled at a particular level on a Web server, and managed modules that also perform request work at the same level.

Example

The following example displays the native and managed modules in the <modules> section of the ApplicationHost.config file.

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Get the <modules> section.  
Set oSection = oWebAdmin.Get( _  
    "ModulesSection.Path='MACHINE/WEBROOT/APPHOST/',Location=''")  
  
' Display the native modules.  
WScript.Echo "---------- Native -------------"  
For Each oModule In oSection.Modules  
    If oModule.Type = "" Then  
        WScript.Echo "   " & oModule.Name  
    End If  
Next  
WScript.Echo   
  
' Display the managed modules.  
WScript.Echo "---------- Managed ----------"  
For Each oModule In oSection.Modules  
    If oModule.Type <> "" Then  
        If Len(oModule.Name) < 12 Then  
            WScript.Echo "   " & oModule.Name & _  
                vbTab & vbTab & vbTab & "[" & oModule.Type & "]"  
        ElseIf Len(oModule.Name) < 20 Then  
            WScript.Echo "   " & oModule.Name & _  
                vbTab & vbTab & "[" & oModule.Type & "]"  
        Else   
            WScript.Echo "   " & oModule.Name & _  
                vbTab & "[" & oModule.Type & "]"  
        End If  
    End If  
Next  

Inheritance Hierarchy

ConfigurationSection

ConfigurationSectionWithCollection

ModulesSection

Requirements

Type Description
Client - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF file WebAdministration.mof

See Also

ConfigurationSectionWithCollection Class
GlobalModuleElement Class
GlobalModulesSection Class
ModuleAction Class