nicob2k Posted October 18, 2007 Share 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 Link to comment Share on other sites More sharing options...
weaponx Posted October 18, 2007 Share 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 Link to comment Share on other sites More sharing options...
nicob2k Posted October 18, 2007 Author Share 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 ... Link to comment Share on other sites More sharing options...
weaponx Posted October 18, 2007 Share Posted October 18, 2007 You should take out the first condition, i'm pretty sure SP2 build number is 2900 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 18, 2007 Moderators Share 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now