Export (0) Print
Expand All
Expand Minimize

OdbcLoggingSection Class [IIS 7 and higher]

IIS 7.0

Specifies configuration settings for logging IIS events to a database through an Open Database Connectivity (ODBC) connection.

class OdbcLoggingSection : ConfigurationSection

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

Name

Description

GetAllowDefinition

(Inherited from ConfigurationSection.)

GetAllowLocation

(Inherited from ConfigurationSection.)

RevertToParent

(Inherited from ConfigurationSection.)

SetAllowDefinition

(Inherited from ConfigurationSection.)

SetAllowLocation

(Inherited from ConfigurationSection.)

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

Name

Description

DataSource

A read/write string value that specifies the system DSN (data source name) for the database to which the log is written. The default is "InternetDb".

Location

(Inherited from ConfigurationSection.) A key property.

Password

A read/write string value that specifies the ODBC database password used for writing to the database during event logging.

Path

(Inherited from ConfigurationSection.) A key property.

SectionInformation

(Inherited from ConfigurationSection.)

TableName

A read/write string value that specifies the name of the ODBC database table where information is written during event logging. The default is "InternetLog".

UserName

A read/write string value that specifies the ODBC database user name used for writing to the database during event logging. The default is "InternetAdmin".

This class contains no subclasses.

ODBC logging allows the logging of IIS data to local Microsoft Access databases or to local or remote Microsoft SQL Server databases.

The following code example specifies new values for the DataSource, Tablename, Username, and Password properties. A helper function displays the values before and after the change.

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

' Get the ODBCLoggingSection.
Set oSection = oWebAdmin.Get("OdbcLoggingSection.Path=" & _
    "'MACHINE/WEBROOT/APPHOST',Location=''")

' Display the class name of the section.
WScript.Echo "[ " & oSection.Path_.Class & " ]"

' Display the initial values.
Call DisplayValues("Initial Values", oSection)

' Specify new ODBCLoggingSection property values.
oSection.DataSource = "ODBCLoggingDB"
oSection.TableName = "ODBCLoggingTable"
oSection.Username = "ODBCLoggingAdmin"
oSection.Password = "ODBCLoggingPassword"

' Save the values to configuration.
oSection.Put_

' Refresh the oSection object variable with the new values.
oSection.Refresh_

' Show the changed values.
Call DisplayValues("New Values", oSection)

' ==== DisplayValues helper function. ====
Function DisplayValues(HeadingText, oSection)
    ' Display a heading.
    WScript.Echo
    WScript.Echo HeadingText
    WScript.Echo String(Len(HeadingText), "-")

    ' Display section properties.
    WScript.Echo "Path: " & oSection.Path
    WScript.Echo "Location: " & oSection.Location
    WScript.Echo "DataSource: " & oSection.DataSource
    WScript.Echo "TableName: " & oSection.TableName
    WScript.Echo "Username: " & oSection.Username
    WScript.Echo "Password: " & oSection.Password
End Function

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

Community Additions

ADD
Show:
© 2014 Microsoft