nicob2k 0 Posted October 18, 2007 Hello, This is my First topic :-) so I'd like to thanks you in advance for all the support you can give me. I've develop an Installer that automatically install MS SQL SERVER 2005 Express, but some of my clients are running Windows version that is not compatible. In this case, I need to install MSDE. NB : MS SQL SERVER 2005 Express need at least WIN XP SP2 I'm having trouble finding the OS build number for all Windows product! Using the @OSBuild function I know that win XP have the @OSBuild = 2600 I don't want to install all version of windows to found this number.... Does anyone have a list? Thanks a lot Nicolas Share this post Link to post Share on other sites
weaponx 16 Posted October 18, 2007 See how this works. MsgBox(0,"","Service Pack: " & ServicePackLevel()) Func ServicePackLevel() $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems Return $objItem.ServicePackMajorVersion Next Else Return 0 Endif Return 0 EndFunc Share this post Link to post Share on other sites
nicob2k 0 Posted October 18, 2007 After a look on the internet, I found that build number is gradually higher since Windows 98 (probably before, but I don't really mater for my script). So I only do : CODEIf @OSBuild = 2600 AND @OSServicePack = "Service Pack 2" or @OSBuild > 2600 then ;Install SQL 2005 Express Else ;Install MSDE EndIf PS/ Thanks weaponx for your help, but I think that the @OSServicePack is simpler to use ... Share this post Link to post Share on other sites
weaponx 16 Posted October 18, 2007 You should take out the first condition, i'm pretty sure SP2 build number is 2900 Share this post Link to post Share on other sites
SmOke_N 211 Posted October 18, 2007 See how this works. MsgBox(0,"","Service Pack: " & ServicePackLevel()) Func ServicePackLevel() $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems Return $objItem.ServicePackMajorVersion Next Else Return 0 Endif Return 0 EndFuncThere is an @OSServicePack. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Share this post Link to post Share on other sites