Demystifying Exchange Server 2003 SP2 IMF Updates
Published Apr 12 2006 12:35 PM 3,987 Views

Hi All,

I thought I would introduce myself to the BLOG-O-Sphere, my name is Scott Roberts and I'm a Software Developer in Test for the Exchange Sustained Engineering team. One of my responsibilities on the Exchange team includes being part of a team that pushes out the update for Intelligent Message Filtering (IMF) via Microsoft Update (MU). This BLOG will cover a few of the areas that we seem to find customers having problems with when trying to get the latest IMF update via MU.

By now, I hope all of you know that new Intelligent Message Filter (IMF) is out in the wild with the release Exchange Server 2003 Service Pack 2 and have moved off of the older version. What you might not be aware of is that Exchange pushes an update twice a month to the Microsoft Update infrastructure to deliver the latest IMF files to your server and this is explained in

http://support.microsoft.com/?kbid=907747. The below will give additional information and troubleshooting steps to make using the IMF update functionality easier and troubleshooting issues less costly. Additionally, you should check our previous post on this subject too.

 

Microsoft Update/Windows Update

 

An IMF Update is the same as any other Exchange Update and therefore will use the 'Microsoft Update' pipe instead of the 'Windows Update' pipe to deliver the update to the customer. Every computer by default uses 'Windows Update' when first installed and can be reached by START > PROGRAM FILES and selecting the 'Windows Update' shortcut.

 

For additional information, I would recommend reading the FAQ on Microsoft Update.

 

What Is Microsoft Update?
It's the new website from Microsoft that helps you update Microsoft Windows and many other Microsoft programs that you've installed, such as Microsoft Office, Microsoft Exchange Server and Microsoft SQL Server, all in one convenient place.

Does it work with Automatic Updates?
Yes. If you turn on Automatic Updates using your settings in Control Panel, Windows will automatically find and install high-priority updates for any Microsoft products that you have installed and that are supported by the website.

If I use Microsoft Update, do I still need to visit the Windows Update website?
No. Microsoft Update provides the same updates you find on the Windows Update website and more. Microsoft Update is designed to make it easier for you to update Windows and your Microsoft products in one place.

 

In order to use Microsoft Update (MU), the computer must 'opt-in' via a website and from that point on the machine will use MU for detecting if it needs updates instead of Windows Update (WU). KB901037 explains 'How to enable and to disable Microsoft Update'. It isn't that difficult to do and only takes a minute.

 

Detection Logic

 

First off, I think it will be important to explain how detection does happen. There are several checks that happen before the update will be downloaded to the machine and installed. The Automatic Update (AU) Service (Description of the Automatic Updates feature in Windows) is responsible for the scan on the local machine and based on its configuration (How to schedule automatic updates in...) will decide how to handle the update. Remember that there is an ActiveX control that needs to be installed and that there is also a possibility that the machine needs an update for 'Windows Update'.

 

The detection that happens during the AU scan that does happen is as follows:

  1. Is one of the Exchange Product installed on the machine?

  2. Is Exchange Server 2003 installed on the machine?

  3. Is Exchange Server 2003 Service Pack 2 installed on the machine?

  4. Is the IMF 'ContentFilterState' registry a DWORD and a value of 1?

  5. Is this particular IMF Update already installed onto the machine?

At this point, the 'AU' then does what is configured to do on the local machine:

  1. The update is automatically installed (AU Scheduled)  and uses the 'localsystem' account for the installation of the update

  2. The update is downloaded and the local user is prompted to install. The update is installed using the credentials of the local user.

  3. The update is not download but the local user is prompted to download and install. The update is installed using the credentials of the local user.

  4. If the scan is initiated by going to http://update.microsoft.com/microsoftupdate/v6/ then it is up for the user to decide. The update is installed using the credentials of the local user.

Enabling IMF Filter Updates

 

To enable Intelligent Message Filter updates, you must create the ContentFilterState registry entry. http://support.microsoft.com/?kbid=907747 explains this some detail. To do this, follow these steps:

 

1.

Ensure that Exchange Server 2003 Service Pack 2 is installed on the machine

2.

Click Start, click Run, type regedit, and then click OK.

3.

Expand the following registry subkey:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange

4.

In the left pane, click Exchange. Then, right-click in the right pane, point to New, and then click DWORD Value.

5.

Type ContentFilterState, and then press ENTER to name the new registry entry.

6.

Right-click ContentFilterState, and then click Modify.

7.

In the Data value box, type 1, and then click OK.

8.

Quit Registry Editor.

9.

In the Services snap-in, restart the Simple Mail Transfer Protocol (SMTP) service.

 

Customer Headaches

 

A few requests from customers have been in the area of creating a tool that does the scan at a schedule time and not install every other update that is also being offered. If the local machine is configured to auto-install updates at a specific time then all updates being offered that are of 'high-priority' will also be installed based on the 'AU settings' regardless if the IMF is offered or not. I created a small vbscript tool to show how someone can use the 'WU API' to write a custom tool so that the customer has some flexibility on how to install the IMF Update. The script will detect or download just the IMF Update based on the parameter passed in at run time. If there is no IMF update detected as needing to be installed then the script exits until the next time it is run.

 

The script follows; please save it into a file called blogIMFV1.vbs, for example. Also please note that seeing that the blog post contains some Unicode characters, in order to view them properly, please set your browser Encoding to "Unicode (UTF-8)" (in IE, go to View > Encoding and then refresh the page after chaning the encoding to Unicode):

 

Option Explicit
'//---------------------------------------------------------------------
'//This is a sample script, not officially supported by Microsoft.
'//---------------------------------------------------------------------


'Simple VBScript to show usage
'Forgetting to use cscript.exe could lead to annoying pop-ups when wscript.echo is called.
'Will run on any machine but only will do *stuff* on an Exchange server configured according to
http://support.microsoft.com/?kbid=907747

On Error Resume Next

Dim  error, i
Dim  objUpdateSession, objUpdateSearcher, objSearchResult
Dim  objupdateInfo, BundleUpdate
Dim  objUpdatesToDownload, objUpdatesToInstall
Dim  UpdateAction, bInstall, bDetect
Dim  IUpdate  
Dim  downloader, installer
Dim  installationResult

 bInstall = false

 if WScript.Arguments.Count = 1 Then

  UpdateAction = lcase(WScript.Arguments.Item(0))
  
  Select Case (UpdateAction)

       Case ("install")
       bInstall = vbTrue
   Case ("detect")
       bInstall = vbFalse
   Case Else
       Usage
  
  End Select
 
 else
  Usage
 end if

 Set objUpdateSession = CreateObject("Microsoft.Update.Session")
 
 if (err.number <> 0) then
  msgEcho ("Microsoft.Update.Session is not present - have you connected to MicrosoftUpdates before?")
  msgEcho ("Microsoft.Update.Session is not present - have you connected to
http://update.microsoft.com/MicrosoftUpdate before?")
 end if

 Set objUpdatesToDownload = CreateObject("Microsoft.Update.UpdateColl")
 Set objUpdatesToInstall  = CreateObject("Microsoft.Update.UpdateColl") 

 msgEcho ( "Setting UpdateSession to Microsoft Update")
 Set objUpdateSearcher = objUpdateSession.CreateupdateSearcher()
 
 objUpdateSession.CreateupdateSearcher()
 

 'By default, the scan will use what AU is configured to use. It could be WSUS or MU/WU.
 'If you want to force the scan to use Microsoft Update and not what AU is configured to use simply uncomment the below lines
 
 'objUpdateSearcher.ServiceID ="7971f918-a847-4430-9279-4a52d1efe18d"
 'objUpdateSearcher.ServerSelection = 3
 'objUpdateSearcher.Online = true

 msgEcho ("Setting SearchResult and performing search")
 Set objSearchResult = objUpdateSearcher.Search("CategoryIDs contains '3cf32f7c-d8ee-43f8-a0da-8b88a6f8af1a'") 'Exchange 2003 GUID
 
 
 if (err.number <> 0) then
  msgEcho ("Have you set the ContentFilterState DWORD registry value?")
  msgEcho ("you connected to
http://update.microsoft.com/MicrosoftUpdate?")
 end if

 msgEcho ("Search completed")
 msgEcho ("Total Updates Returned:" & objSearchResult.Updates.Count)

 '//
 '// List current updates and status
 '//

 msgEcho ( "All Exchange Updates Status:")
 msgEcho ("")
 
 msgEcho ( VBTAB & "Is Installed: ")
 For i = 0 to objSearchResult.Updates.Count-1
 
  if (objSearchResult.Updates.Item(i).isInstalled = true) then
   msgEcho ( VBTAB & VBTAB & objSearchResult.Updates.Item(i).title)
  end if

 Next

 msgEcho ( VBTAB & "Not Installed: ")
 For i = 0 to objSearchResult.Updates.Count-1
 
  if (objSearchResult.Updates.Item(i).isInstalled = false)  then
   msgEcho ( VBTAB & VBTAB & objSearchResult.Updates.Item(i).title)
  end if

 Next
 
 '//
 '// List only the IMF updates
 '//

 msgEcho ("")
 msgEcho ("IMF Update Status:")
 msgEcho ("")
 msgEcho ( VBTAB & "Is Installed: ")
 For i = 0 to objSearchResult.Updates.Count-1
 
  if ( IsTitleOfUpdateIMFUpdate(objSearchResult.Updates.Item(i).title) ) then

   if (objSearchResult.Updates.Item(i).isInstalled = true) then
    msgEcho ( VBTAB & VBTAB & objSearchResult.Updates.Item(i).title)
   end if
  end if
 Next

 msgEcho ( VBTAB & "Not Installed: ")
 For i = 0 to objSearchResult.Updates.Count-1
 
  'This will only work for English
  if ( IsTitleOfUpdateIMFUpdate(objSearchResult.Updates.Item(i).title) ) then

   if (objSearchResult.Updates.Item(i).isInstalled = false) then
    msgEcho ( VBTAB & VBTAB & objSearchResult.Updates.Item(i).title)
   
    if (bInstall) then
     msgEcho ( VBTAB & VBTAB & VBTAB & "Adding to the Download Queue")
     objUpdatesToDownload.Add(objSearchResult.Updates.Item(i))
    end if
    
   end if
  end if
 Next

 if Not (bInstall) then
  msgEcho ("Exiting - detection only")
  wscript.quit (0)
 end if

 if (objUpdatesToDownload.Count = 0) then
  msgEcho ("No 'Updates for Intelligent Message Filter' to download")
  wscript.quit (0)
 end if
   
 msgEcho ("Downloading updates...")
 Set downloader = objUpdateSession.CreateUpdateDownloader()
 downloader.Updates = objUpdatesToDownload
 downloader.Download()

 msgEcho ("Adding downloaded updates to the install list")
 For i = 0 to objUpdatesToDownload.Count-1
 
  if (objUpdatesToDownload.Item(i).IsDownloaded = true) then
   objUpdatesToInstall.Add(objUpdatesToDownload.Item(i)) 
     end if
 
 Next
 
 if objUpdatesToInstall.Count = 0 then
  msgEcho ("No 'Updates for Intelligent Message Filter' to install - an error at this point")
  wscript.quit (-1)
 end if
   
 
 Set installer = objUpdateSession.CreateUpdateInstaller()

 msgEcho ("Installing Updates...")

 installer.Updates = objUpdatesToInstall
 
 Set installationResult = installer.Install()
 
 if (installationResult.ResultCode <> 2) then
  msgEcho ("Installation Result: Bad Error (" & installationResult.ResultCode & ")")
 else
  msgEcho ("Installation Result: Succeeded")
 end if

 msgEcho ("Reboot Required: " & installationResult.RebootRequired)
 

 msgEcho ("Exiting with Error 0x" & Hex(Err.Number) & " (" & Err.Description & ")")
 WScript.Quit(Err.Number)

Function IsTitleOfUpdateIMFUpdate(StrTitle)

 IsTitleOfUpdateIMFUpdate = vbFalse

 if ( StrComp (objSearchResult.Updates.Item(i).title, "Update for Intelligent Message Filter for Exchange Server 2003:") > 0 ) OR _
   ( StrComp (objSearchResult.Updates.Item(i).title, "Exchange Server 2003 Intelligent Message Filter ? ???:") > 0 ) OR  _
   ( StrComp (objSearchResult.Updates.Item(i).title, "Mise à jour pour Intelligent Message Filter pour Exchange Server 2003:") > 0 ) OR  _
   ( StrComp (objSearchResult.Updates.Item(i).title, "Update für Intelligent Message Filter für Exchange Server 2003:") > 0 ) OR  _
   ( StrComp (objSearchResult.Updates.Item(i).title, "Exchange Server 2003 Intelligent Message Filter ? ???????(KB907747):") > 0 ) OR  _
   ( StrComp (objSearchResult.Updates.Item(i).title, "Actualización para Intelligent Message Filter para Exchange Server 2003:") > 0 ) OR  _
   ( StrComp (objSearchResult.Updates.Item(i).title, "Aggiornamento per Intelligent Message Filter per Exchange Server 2003:") > 0 ) OR  _
   ( StrComp (objSearchResult.Updates.Item(i).title, "?? for Exchange Server 2003 Intelligent Message Filter:") > 0 ) OR  _
   ( StrComp (objSearchResult.Updates.Item(i).title, "Exchange Server 2003 Intelligent Message Filter ? ??:") > 0 ) then IsTitleOfUpdateIMFUpdate = vbTrue

End Function


Sub msgEcho (strEcho)

 WScript.Echo(NOW() & vbTab & strEcho)

End Sub 

Sub Usage()
 Wscript.Echo "Invalid Arguements"
 Wscript.Echo vbTab & "Usage: imfUpdateScript.vbs ActionType"
 Wscript.Echo vbTab & "ActionType - 'Detect' or 'Install'"
 Wscript.Quit(-1)
End Sub

 

- Scott Roberts

26 Comments
Version history
Last update:
‎Jul 01 2019 03:13 PM
Updated by: