How do I bulk change IIS Logging fields?

Posted on 2011-10-06
Last Modified: 2012-05-12
We are running IIS 6 and have noticed that the date and time are not being logged.

We can go into each site manually and in advanced logging properties tick the "date" and "time" property. Restarting the site fixes the problem.

Our problem is that we have several thousand sites.

Is there a way to apply this change to all sites on a server?

We have already tried changing the parameters in the root and restarting WWW Publishing, however that did not have an effect.
Question by:turnto11
    LVL 30

    Accepted Solution


    You use ADSUTIL to achieve this. Each Extended Log option has a specific value assigned.

    For example:

    LogExtFileDate             = 1
    LogExtFileTime             = 2
    LogExtFileClientIp             = 4
    LogExtFileUserName       = 8
    LogExtFileSiteName       = 16
    LogExtFileComputerName       = 32
    LogExtFileServerIp             = 64
    LogExtFileMethod              = 128
    LogExtFileUriStem             = 256
    LogExtFileUriQuery             = 512
    LogExtFileHttpStatus       = 1024
    LogExtFileWin32Status       = 2048
    LogExtFileBytesSent       = 4096
    LogExtFileBytesRecv       = 8192
    LogExtFileTimeTaken       = 16384
    LogExtFileCookie             = 131072
    LogExtFileReferer             = 262144
    LogExtFileServerPort       = 32768
    LogExtFileProtocolVersion       = 524288
    LogExtFileUserAgent       = 65536
    LogExtFileHttpSubStatus       = 2097152
    LogExtFileHost              = 1048576

    For example;

    To Assign All Sites in IIS to have ALL Advanced Logging options selected [x], you would execute the following.
        cd c:\inetpub\AdminScripts\
        adsutil.vbs SET W3SVC/LogExtFileFlags "4194303"

    NOTE the lack of WEBSITE IDENTIFIER between W3SVC and the Option.

    To Assign it to just (1) SITE you execute it with the WEBSITE IDENTIFIER included.
        cd c:\inetpub\AdminScripts\
        adsutil.vbs SET W3SVC/<WEB-SITE-ID>/LogExtFileFlags "4194303"

    So to get the proper settings you need, start with "4194303" - Equals ALL Settings checked - and begin substract the the values from above you don't want checked. The remain is the addition of the value that are [x].

    Any value that you do not subtract from "4194303" is set to [x].

    msdn reference has the detail value for each flag:


    Author Comment

    That did it. Thanks!

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
    The viewer will learn how to dynamically set the form action using jQuery.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now