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.
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
ConfigurationSection
OdbcLoggingSection
Type | Description |
|---|
Client | Requires IIS 7 on Windows Vista. |
Server | Requires IIS 7 on Windows Server 2008. |
Product | IIS 7 |
MOF file | WebAdministration.mof |
Reference
Other Resources