'ManageEngine Desktop Central 'Pre requisite patches for windows Vista and Server 2008 SP2 32 bit to install IE 9 '=================================================================== On Error Resume Next returncode = 0 Set WshShell = CreateObject("WScript.Shell") kb1 = "Windows6.0-KB971512-x86.msu" kb2 = "Windows6.0-KB2117917-x86.msu" kb_reg1 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-DGT-Package-TopLevel~31bf3856ad364e35~x86~~7.0.6002.18107\CurrentState" kb_reg2 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB2117917~31bf3856ad364e35~x86~~6.0.1.5\CurrentState" kb_val = "49" kb_ret1 = IsRegistryValuegreater(kb_reg1,kb_val) kb_ret2 = IsRegistryValuegreater(kb_reg2,kb_val) if kb_ret2 = 1 then if kb_ret1 = 1 then 'wscript.echo "IF 1" returncode=WshShell.Run("%WINDIR%\\system32\\wusa.exe KB2117917 /quiet /norestart",0,TRUE) 'wscript.echo "%WINDIR%\\system32\\wusa.exe KB2117917 /quiet /norestart" returncode=WshShell.Run("%WINDIR%\\system32\\wusa.exe KB971512 /quiet /norestart",0,TRUE) 'wscript.echo "%WINDIR%\\system32\\wusa.exe KB971512 /quiet /norestart" returncode=WshShell.Run("%WINDIR%\\system32\\wusa.exe Windows6.0-KB971512-x86.msu /quiet /norestart",0,TRUE) 'wscript.echo "%WINDIR%\\system32\\wusa.exe Windows6.0-KB971512-x86.msu /quiet /norestart" returncode=WshShell.Run("%WINDIR%\\system32\\wusa.exe Windows6.0-KB2117917-x86.msu /quiet /norestart",0,TRUE) 'wscript.echo "%WINDIR%\\system32\\wusa.exe Windows6.0-KB2117917-x86.msu /quiet /norestart" else 'wscript.echo "IF 2" returncode=WshShell.Run("%WINDIR%\\system32\\wusa.exe KB2117917 /quiet /norestart",0,TRUE) 'wscript.echo "%WINDIR%\\system32\\wusa.exe KB2117917 /quiet /norestart" returncode=WshShell.Run("%WINDIR%\\system32\\wusa.exe Windows6.0-KB971512-x86.msu /quiet /norestart",0,TRUE) 'wscript.echo "%WINDIR%\\system32\\wusa.exe Windows6.0-KB971512-x86.msu /quiet /norestart" returncode=WshShell.Run("%WINDIR%\\system32\\wusa.exe Windows6.0-KB2117917-x86.msu /quiet /norestart",0,TRUE) 'wscript.echo "%WINDIR%\\system32\\wusa.exe Windows6.0-KB2117917-x86.msu /quiet /norestart" end if else if kb_ret1 = 1 then 'wscript.echo "IF 3" returncode=WshShell.Run("%WINDIR%\\system32\\wusa.exe Windows6.0-KB2117917-x86.msu /quiet /norestart",0,TRUE) 'wscript.echo "%WINDIR%\\system32\\wusa.exe Windows6.0-KB2117917-x86.msu /quiet /norestart" else 'wscript.echo "IF 4" returncode=WshShell.Run("%WINDIR%\\system32\\wusa.exe Windows6.0-KB971512-x86.msu /quiet /norestart",0,TRUE) 'wscript.echo "%WINDIR%\\system32\\wusa.exe Windows6.0-KB971512-x86.msu /quiet /norestart" returncode=WshShell.Run("%WINDIR%\\system32\\wusa.exe Windows6.0-KB2117917-x86.msu /quiet /norestart",0,TRUE) 'wscript.echo "%WINDIR%\\system32\\wusa.exe Windows6.0-KB2117917-x86.msu /quiet /norestart" end if end if Wscript.Quit returncode '==================================================== 'Script to check given value found in Registry value '==================================================== Function IsRegistryValuegreater(theEntry , gvalue) On error resume next set shell = CreateObject("WScript.Shell") entry = shell.RegRead(theEntry) If Err.Number = 0 then if CInt(gvalue) > CInt(entry)then Err.Clear IsRegistryValuegreater = 1 'wscript.echo "greater" else Err.Clear IsRegistryValuegreater = 0 'wscript.echo "value not greater" end if else Err.Clear IsRegistryValuegreater = 0 'wscript.echo "not found" end if End Function