Condividi tramite


Sample Script to Verify IIS File Versions for KB973917

Microsoft recently released an update for Internet Information Services (IIS), as described in the following article:

 

 

Description of the update that implements Extended Protection for Authentication in Internet Information Services (IIS)

https://support.microsoft.com/kb/973917

 

 

In the Known Issues section, the KB describes a known issue with the update when it is installed on Windows Server 2003 with IIS6. More information about the known issue is also described in the following article:

 

Internet Information Services 6.0 may not function correctly after installing KB973917

https://support.microsoft.com/kb/2009746/

 

 

To mitigate the known issue, server administrators should ensure all of the IIS components are at the Windows Server Service Pack 2 version or later. The KB973917 article lists the component names and the version numbers to check for.

 

To automate the version checking process, it is possible to write a script that iterates through the IIS components and verifies the version number. The following script is an example of such an automation.

 

NOTE: The following script is for x86-based systems only and is provided AS-IS with no warranty or support, for sample purposes only. 

 

 'Created by Punit Shah to verify the installation of IIS binaries on Windows Server 2003 SP2
'Save into a vbs file as Verify2003SP2.vbs then run as: cscript.exe Verify2003SP2.vbs

Dim myFileArray(55)
Dim myFileArray2(1)
Dim myFileArray3(0)
Dim inetsrvpath 

myFileArray2(0)    = "Nntpsnap.dll"
myFileArray2(1) = "Smtpsnap.dll"

myFileArray3(0) = "Iisclex4.dll"

myFileArray(0)  = "Adrot.dll"
myFileArray(1) = "Adsiis.dll"
myFileArray(2)    = "Asp.dll"
myFileArray(3)   = "Browscap.dll"
myFileArray(4)  = "Certobj.dll"
myFileArray(5)   = "Coadmin.dll"
myFileArray(6)   = "Controt.dll"
myFileArray(7)   = "Davcdata.exe"
myFileArray(8)  = "Davcprox.dll"
myFileArray(9)  = "Gzip.dll"
myFileArray(10) = "Httpext.dll"
myFileArray(11)  = "Httpmib.dll"
myFileArray(12)  = "Httpodbc.dll"
myFileArray(13) = "Iisadmin.dll"
myFileArray(14) = "Iiscfg.dll"
myFileArray(15)   = "Iisext.dll"
myFileArray(16)   = "Iislog.dll"
myFileArray(17)   = "Iisres.dll"
myFileArray(18)   = "Iisrstas.exe"
myFileArray(19) = "Iisui.dll"
myFileArray(20)    = "Iisuiobj.dll"
myFileArray(21) = "Iisutil.dll"
myFileArray(22)  = "Iisw3adm.dll"
myFileArray(23) = "Iiswmi.dll"
myFileArray(24)   = "Inetinfo.exe"
myFileArray(25) = "Inetmgr.dll"
myFileArray(26)  = "Inetmgr.exe"
myFileArray(27)  = "Infocomm.dll"
myFileArray(28) = "Isapips.dll"
myFileArray(29)  = "Isatq.dll"
myFileArray(30)    = "Iscomlog.dll"
myFileArray(31) = "Logscrpt.dll"
myFileArray(32) = "Lonsint.dll"
myFileArray(33)  = "Metadata.dll"
myFileArray(34) = "Nextlink.dll"
myFileArray(35) = "Nntpadm.dll"
myFileArray(36)  = "Rpcref.dll"
myFileArray(37)   = "Seo.dll"
myFileArray(38)  = "Smtpadm.dll"
myFileArray(39)  = "Ssinc.dll"
myFileArray(40)    = "Svcext.dll"
myFileArray(41)   = "Uihelper.dll"
myFileArray(42) = "Urlauth.dll"
myFileArray(43)  = "W3cache.dll"
myFileArray(44)  = "W3comlog.dll"
myFileArray(45) = "W3core.dll"
myFileArray(46)   = "W3ctrlps.dll"
myFileArray(47) = "W3ctrs.dll"
myFileArray(48)   = "W3dt.dll"
myFileArray(49) = "W3ext.dll"
myFileArray(50)    = "W3isapi.dll"
myFileArray(51)  = "W3tp.dll"
myFileArray(52) = "W3wp.exe"
myFileArray(53) = "Wam.dll"
myFileArray(54)  = "Wamps.dll"
myFileArray(55)    = "Wamreg.dll"

set shell = CreateObject("WScript.Shell")
inetsrvpath = shell.ExpandEnvironmentStrings("%WinDir%") 
inetsrvpath = inetsrvpath & "\system32\inetsrv\"
allFine = 0

For Each file in myFileArray2
    Set objFSO = CreateObject("Scripting.FileSystemObject")
 iisFile =  inetsrvpath & file
   If objFSO.FileExists(iisFile) Then
      Set objFile = objFSO.GetFile(iisFile)
       If objFSO.GetFileVersion(iisFile) < "6.0.3728.0" Then 
           Wscript.Echo "WARNING!!! " & iisFile & "(" & objFSO.GetFileVersion(iisFile) & ") does not match the expected version(6.0.3728.0) on Windows Server 2003 SP2"
            allFine = 1
     End If
  Else
        Wscript.Echo "WARNING!!! " & iisFile  & " does not exist."
      allFine = 1
 End If
Next


For Each file in myFileArray3
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 iisFile =  inetsrvpath & file
   If objFSO.FileExists(iisFile) Then
      Set objFile = objFSO.GetFile(iisFile)
       If objFSO.GetFileVersion(iisFile) < "6.0.3790.0" Then 
           Wscript.Echo "WARNING!!! " & iisFile & "(" & objFSO.GetFileVersion(iisFile) & ") does not match the expected version(6.0.3790.0) on Windows Server 2003 SP2"
            allFine = 1
     End If
  Else
        Wscript.Echo "WARNING!!! " & iisFile  & " does not exist."
      allFine = 1
 End If
Next


For Each file in myFileArray
  Set objFSO = CreateObject("Scripting.FileSystemObject")
 iisFile =  inetsrvpath & file
   If objFSO.FileExists(iisFile) Then
      Set objFile = objFSO.GetFile(iisFile)
       If objFSO.GetFileVersion(iisFile) < "6.0.3790.3959" Then 
            Wscript.Echo "WARNING!!! " & iisFile & "(" & objFSO.GetFileVersion(iisFile) & ") does not match the expected version(6.0.3790.3959) on Windows Server 2003 SP2"
         allFine = 1
     End If
  Else
        Wscript.Echo "WARNING!!! " & iisFile  & " does not exist."
      allFine = 1
 End If
Next


If allFine = 0 Then
   Wscript.Echo "IIS installation on this Windows Server 2003 SP2 is fine!"
Else
    Wscript.Echo "IIS installation on this Windows Server 2003 SP2 is broken!"
  Wscript.Echo "Check above messages for details about mismatched dlls!"
End If