Configure Boolean, Integer, and String Data Types

When using scripts to configure IIS, you'll need to know how to configure Boolean, Integer, and String attribute data types. Learn the steps for configuring these data types.

Ethan Wilansky

October 28, 2002

2 Min Read
ITPro Today logo in a gray background | ITPro Today


You use similar methods to configure all Boolean, Integer, and String data types. If you use a script to configure these data types, your script must perform the following three steps:

  1. Use the GetObject function and ADsPath to bind to a metabase key.

  2. Use the Put method of the ADSI core interface, IADs, to configure an attribute.

  3. Use the IADs SetInfo method to commit the modified object back to its corresponding metabase key.

IIS_CommonDTs_Write.vbs, which Web Listing 2 shows, demonstrates how to configure each of these attribute data types for the first Web server in an IIS installation, initially named Default Web site, which IIS automatically creates at installation. Callout A in Web Listing 2 shows three lines that complete Step 1, binding to a metabase key. The first two lines of code construct the path to the key, and the third line uses the GetObject function to bind to the metabase key. If you're not familiar with the path W3SVC1, review "How to Use a Script to Access and Read the Metabase." The article also explains how to change this path based on the settings you want to configure.

Callout B in Web Listing 2 shows how to use the Put method of IADs to configure three attributes: DontLog (Boolean), ConnectionTimeout (Integer), and ServerComment (String). These three attributes are contained in a Web server's properties—in this case, the first Web server's properties. The DontLog attribute specifies whether to write client requests to the IIS log file. If you set this value to True, IIS doesn't log client visits. The ConnectionTimeout attribute specifies how many seconds the server waits before disconnecting an inactive connection. IIS_CommonDTs_Write.vbs sets the value to 600 seconds or 10 minutes. The ServerComment attribute sets the Web server's name. IIS_CommonDTs_Write.vbs resets the value from Default Web site to Default. The SetInfo method call at the end of callout B commits the modifications to the metabase. The code at callout C in Web Listing 2 shows how to read the three values to verify that the changes were successful.

One configuration peculiarity that you need to be aware of is how to set Integer data type attributes that disable a feature or that both enable the feature and set an Integer value. For example, the script IISAtt_WriteMaxBandwith.vbs, which Web Listing 3 shows, demonstrates how to disable and enable the MaxBandWidth attribute. The code at callout A in Web Listing 3 uses the VBScript True keyword to disable this attribute so that IIS doesn't throttle back bandwidth for a Web server. The True keyword has a numeric value of -1, so you can specify -1 instead of using the True keyword. Callout B in Web Listing 3 uses an Integer value set in 1024Kbps increments to enable the MaxBandWidth attribute. The last two lines of callout B read and display the attribute's value in Kilobits per second.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like