ActiveXperts Network Monitor
Monitor servers, workstations, devices and applications in your network

Quicklinks


Internet Information Server 5.x Basic Administration Scripts

Back Up the Metabase
Back Up the Metabase Using a Password
Delete a Backup
Enumerate Backups
Enumerate Filter Load Order
Enumerate IIS Class Members
Enumerate IIS Filters
Enumerate Log Modules
Enumerate MIME Maps
List IIS Bandwidth Information
Modify an IIS Filter Setting Metabase Property
Restore a Metabase Backup
Restore a Metabase Using a Password


You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.



Back Up the Metabase


Backs up the metabase to a file named ScriptedBackup.
Const MD_BACKUP_HIGHEST_VERSION = &HFFFFFFFF
Const MD_BACKUP_OVERWRITE = 1

strComputer = "LocalHost"
Set objComputer = GetObject("IIS://" & strComputer & "")
objComputer.Backup "ScriptedBackup", MD_BACKUP_HIGHEST_VERSION,_
     MD_BACKUP_OVERWRITE
	

Back Up the Metabase Using a Password


Backs up the metabase to a file named ScriptedBackup, assigning the backup a password of ie456@k.
Const MD_BACKUP_HIGHEST_VERSION = &HFFFFFFFE 
Const MD_BACKUP_OVERWRITE = 1

strComputer = "LocalHost"
Set objComputer = GetObject("IIS://" & strComputer & "")
objComputer.BackupWithPassword "ScriptedBackup", _
    MD_BACKUP_HIGHEST_VERSION, MD_BACKUP_OVERWRITE, "ie456@k"
	

Delete a Backup


Deletes version 0 of the backup file named ScriptedBackup.
Const BACKUP_VERSION = 0

strComputer = "LocalHost"
Set objComputer = GetObject("IIS://" & strComputer & "")
objComputer.DeleteBackup "ADSIBackup", BACKUP_VERSION
	

Enumerate Backups


Returns information about all the IIS backup files on a computer.
On Error Resume Next

Const MD_BACKUP_NO_MORE_BACKUPS = &H80070103
 
strComputer = "LocalHost"
Set objIIS = GetObject("IIS://" & strComputer & "")
intIndex = 0

Do While True
    strName = ""
    objIIS.EnumBackups strName, intIndex, strVersion, _
        strLocation, strDateTime
    If (Err.Number <> 0) Then
        If (Err.Number = MD_BACKUP_NO_MORE_BACKUPS) Then
            Exit Do
        End If
    End If       
       
    WScript.Echo "Name: " & strName
    Wscript.Echo "Version Number: " & strVersion 
    Wscript.Echo "Backup Location: " & strLocation
    Wscript.Echo "Backup Date: " & strDateTime
    Wscript.Echo
        
    intIndex = intIndex + 1
Loop
	

Enumerate Filter Load Order


Enumerates the filter load order on an IIS server.
strComputer = "LocalHost"
Set objIIS = GetObject("IIS://" & strComputer & "/W3SVC/Filters")

Wscript.Echo "Filter Load Order: " & objIIS.FilterLoadOrder
	

Enumerate IIS Class Members


Returns all instances of the Web service, FTP service, NNTP service, and POP3 service classes on a server.
strComputer = "LocalHost"
Set objIIS = GetObject("IIS://" & strComputer & "/W3SVC")

For Each objItem in objIIS
    If objItem.class = "IIsWebServer" Then
        Wscript.Echo objItem.Name
    End If
Next
 
Wscript.Echo
 
Set objIIS = GetObject("IIS://" & strComputer & "/MSFTPSVC")
For Each objItem in objIIS
    If objItem.class = "IIsFtpServer" Then
        Wscript.Echo objItem.Name
    End If
Next
 
Wscript.Echo
 
Set objIIS = GetObject("IIS://" & strComputer & "/NNTPSVC")
For Each objItem in objIIS
    If objItem.class = "IIsNntpServer" Then
        Wscript.Echo objItem.Name
    End If
Next
 
Wscript.Echo
 
Set objIIS = GetObject("IIS://" & strComputer & "/SMTPSVC")
For Each objItem in objIIS
    If objItem.class = "IIsSmtpServer" Then
        Wscript.Echo objItem.Name
    End If
Next
	

Enumerate IIS Filters


Returns information about all the IIS filters on a computer.
strComputer = "LocalHost"
Set colFilters = GetObject("IIS://" & strComputer & "/W3SVC/Filters")
 
For Each objFilter in colFilters
    Wscript.Echo "Name: " & objFilter.Name
    Wscript.Echo "Filter Description: " & objFilter.FilterDescription
    Wscript.Echo "Filter Path: " & objFilter.FilterPath
    Wscript.Echo "Filter Enabled: " & objFilter.FilterEnabled
    Wscript.Echo "Filter State: " & objFilter.FilterState
    Wscript.Echo "Filter Flags: " & objFilter.FilterFlags
    Wscript.Echo
Next
	

Enumerate Log Modules


Returns a list of all log modules found on a server.
strComputer = "LocalHost"
Set colLogs = GetObject("IIS://" & strComputer & "/Logging")
 
For Each objLog in colLogs
    Wscript.Echo "Name: " & objLog.Name
Next
	

Enumerate MIME Maps


Returns the MIME Maps on a server.
strComputer = "LocalHost"
Set objIIS = GetObject("IIS://" & strComputer & "/MimeMap")
arrMaps = objIIS.GetEx("MimeMap")
 
For i = 0 to Ubound(arrMaps)
    Wscript.Echo "Extension: " & arrMaps(i).Extension
    Wscript.Echo "Type: " & arrMaps(i).MimeType
    Wscript.Echo 
Next
	

List IIS Bandwidth Information


Returns bandwidth information for an IIS server.
strComputer = "LocalHost"
Set objIIS = GetObject("IIS://" & strComputer & "")

Wscript.Echo "Maximum Bandwidth: " & objIIS.MaxBandwidth
Wscript.Echo "Maximum Bandwidth Blocked: " & objIIS.MaxBandwidthBlocked
	

Modify an IIS Filter Setting Metabase Property


Demonstration script that modifies a filter setting property (FilterEnabled) in the IIS metabase.
strComputer = "LocalHost"
Set objIIS = GetObject("IIS://" & strComputer & "/W3SVC/Filters/Compression")\

objIIS.FilterEnabled = FALSE
objIIS.SetInfo
	

Restore a Metabase Backup


Restores the metabase using a backup named Scripted Backup.
Const MD_BACKUP_HIGHEST_VERSION = &HFFFFFFFE 

strComputer = "LocalHost"
Set objComputer = GetObject("IIS://" & strComputer & "")

objComputer.Restore "ScriptedBackup", MD_BACKUP_HIGHEST_VERSION, 0
	

Restore a Metabase Using a Password


Restore the metabase using a backup named ScriptedBackup and a password of ie456@k.
Const MD_BACKUP_HIGHEST_VERSION = &HFFFFFFFE 

strComputer = "LocalHost"
Set objComputer = GetObject("IIS://" & strComputer & "")

objComputer.RestoreWithPassword "ScriptedBackup", _
    MD_BACKUP_HIGHEST_VERSION, 0, " ie456@k"