Now that IMF updates are available though Microsoft update see and the updates should start getting more regular I wanted something that would tell me what version of the IMF update my servers where running. After reading KB907747 the way to do this seemed to be to write a script that would query a few keys in the registry on each of the servers.
“The existing active version of the .dat file that is currently installed on the computer is recorded under the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Exchange Server 2003\SP3
For example, after you install the IMF-KB907747-2005.12.14-x86.exe update, the registry entry is similar to the following:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Exchange Server 2003\SP3\KB907747
This registry entry is verified every time that an update is offered for installation. If an update is successfully installed, the registry entry is updated.” And from the Exchange Team Blog “Over the course of the regular update cycle, this date will change while the name/number of the KB itself ‘(KB907747)’ will remain intact”
So a basic script to show the date of the last IMF update package can be done by querying the “HKEY_LOCAL_MACHINE\Software\Microsoft\Updates\Exchange Server 2003\SP3\KB907747\ PackageVersion” registry key
I put this together in a script that will query all the Exchange servers in a domain and then query this registry key on each of these servers and display if there are any IMF updates that have been applied and the date the update was applied. I’ve put a downloadable copy of this script here the script itself looks like this
set conn = createobject("ADODB.Connection")
set com = createobject("ADODB.Command")
Set iAdRootDSE = GetObject("LDAP://RootDSE")
strNameingContext = iAdRootDSE.Get("configurationNamingContext")
Conn.Provider = "ADsDSOObject"
Conn.Open "ADs Provider"
svcQuery = "<LDAP://" & strNameingContext & ">;(objectCategory=msExchExchangeServer);name,serialNumber,distinguishedName;subtree"
Com.ActiveConnection = Conn
Com.CommandText = svcQuery
Set Rs = Com.Execute
Wscript.echo "Exchange Servers Versions IMF Updates"
Wscript.echo
While Not Rs.EOF
arrSerial = rs.Fields("serialNumber")
For Each Serial In arrSerial
strexserial = Serial
Next
call getIMFversion(rs.fields("name"))
Rs.MoveNext
Wend
Rs.Close
Conn.Close
Set Rs = Nothing
Set Com = Nothing
Set Conn = Nothing
function getIMFversion(strComputer)
on error resume next
const HKEY_LOCAL_MACHINE = &H80000002
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Updates\Exchange Server 2003\SP3\KB907747"
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, "PackageVersion", Imfver
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, "InstalledDate",
Imfinstdate
if isnull(Imfver) then
wscript.echo strComputer & " : No IMF Updates Installed"
wscript.echo
else
wscript.echo strComputer & " : " & Imfver
wscript.echo "Update Installed on : " & Imfinstdate
wscript.echo
end if
end function
“The existing active version of the .dat file that is currently installed on the computer is recorded under the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Exchange Server 2003\SP3
For example, after you install the IMF-KB907747-2005.12.14-x86.exe update, the registry entry is similar to the following:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Exchange Server 2003\SP3\KB907747
This registry entry is verified every time that an update is offered for installation. If an update is successfully installed, the registry entry is updated.” And from the Exchange Team Blog “Over the course of the regular update cycle, this date will change while the name/number of the KB itself ‘(KB907747)’ will remain intact”
So a basic script to show the date of the last IMF update package can be done by querying the “HKEY_LOCAL_MACHINE\Software\Microsoft\Updates\Exchange Server 2003\SP3\KB907747\ PackageVersion” registry key
I put this together in a script that will query all the Exchange servers in a domain and then query this registry key on each of these servers and display if there are any IMF updates that have been applied and the date the update was applied. I’ve put a downloadable copy of this script here the script itself looks like this
set conn = createobject("ADODB.Connection")
set com = createobject("ADODB.Command")
Set iAdRootDSE = GetObject("LDAP://RootDSE")
strNameingContext = iAdRootDSE.Get("configurationNamingContext")
Conn.Provider = "ADsDSOObject"
Conn.Open "ADs Provider"
svcQuery = "<LDAP://" & strNameingContext & ">;(objectCategory=msExchExchangeServer);name,serialNumber,distinguishedName;subtree"
Com.ActiveConnection = Conn
Com.CommandText = svcQuery
Set Rs = Com.Execute
Wscript.echo "Exchange Servers Versions IMF Updates"
Wscript.echo
While Not Rs.EOF
arrSerial = rs.Fields("serialNumber")
For Each Serial In arrSerial
strexserial = Serial
Next
call getIMFversion(rs.fields("name"))
Rs.MoveNext
Wend
Rs.Close
Conn.Close
Set Rs = Nothing
Set Com = Nothing
Set Conn = Nothing
function getIMFversion(strComputer)
on error resume next
const HKEY_LOCAL_MACHINE = &H80000002
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Updates\Exchange Server 2003\SP3\KB907747"
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, "PackageVersion", Imfver
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, "InstalledDate",
Imfinstdate
if isnull(Imfver) then
wscript.echo strComputer & " : No IMF Updates Installed"
wscript.echo
else
wscript.echo strComputer & " : " & Imfver
wscript.echo "Update Installed on : " & Imfinstdate
wscript.echo
end if
end function