Code:
On Error Resume Next

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")
 
Dim strValue
strValue = ""
'Determine most recent installed version of Java
strKeyPath = "SOFTWARE\Microsoft\Internet Explorer\AdvancedOptions\JAVA_SUN\SELECT"
strValueName = "RegPath"
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
'Wscript.Echo strValue 'something like Software\JavaSoft\Java Plug-in\1.6.0_02

'Set values for most recent version
If strValue <> "" Then
	strKeyPath = strValue
	strValueName = "UseJava2IExplorer"
	dwValue = 0
	oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
	strValueName = "HideSystemTrayIcon"
	dwValue = 1
	oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
End If

'Set values for java versions on the standard desktop image
'Version 1.3.1_15
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.3.1_15"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Version 1.4.2_07
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.4.2_07"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "HideSystemTrayIcon"
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Version 1.5.0_01
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.5.0_01"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "HideSystemTrayIcon"
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Disable Java Automatic Updates
strKeyPath = "SOFTWARE\JavaSoft\Java Update\Policy"
strValueName = "EnableJavaUpdate"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "EnableAutoUpdateCheck"
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue