john123 Posted April 4, 2009 Posted April 4, 2009 To get "Microsoft Windows XP", I used: Regread("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","ProductName")Please tell me how to get "Professional" edition and "Version 2002"?Thanks for your help.Image :http://farm4.static.flickr.com/3303/341111..._a5a2b069d9.jpg
Authenticity Posted April 4, 2009 Posted April 4, 2009 (edited) Dim $oWMI = ObjGet('winmgmts:{impersonationLevel=impersonate}!//./root/cimv2') Dim $oOSs = $oWMI.InstancesOf('Win32_OperatingSystem') For $oOS In $oOSs ConsoleWrite($oOS.Caption & @TAB & $oOS.Version & @LF) NextoÝ÷ ØêÚºÚ"µÍÛØ[ÛÛÝ ÌÍÝYÓÔÕTÒSÓSÈH ÌÎNÙÛÜÓÔÕÚ[Û[ÔÚ^NÙÛÜÓXZÜÚ[ÛÉÌÎNÈ [ÈÂBIÌÎNÙÛÜÓZ[ÜÚ[ÛÙÛÜÐZ[[XÙÛÜÔ]ÜRYØÚÞÔÑÚ[ÛÌLIÌÎNÂBB[H ÌÍÝÔÕHHÝXÝÜX]J ÌÍÝYÓÔÕTÒSÓSÊBÝXÝÙ]]J ÌÍÝÔÕK ÌÎNÙÓÔÕÚ[Û[ÔÚ^IÌÎNËÝXÝÙ]Ú^J ÌÍÝÔÕJJB[H ÌÍØT]HØ[ ÌÎNÚÙ[Ì ÌÎNË ÌÎNÚ[ ÌÎNË ÌÎNÑÙ]Ú[Û^ ÌÎNË ÌÎNÜÌÎNËÝXÝÙ] ÌÍÝÔÕJJBYÝÜ[SØØ[ ÌÍÜÓÙÈH ÌÎNÓXZÜÚ[Û ÌÎNÈ [ÈÝXÝÙ]]J ÌÍÝÔÕK ÌÎNÙÓXZÜÚ[ÛÌÎNÊH [È [ÈÂBIÌÎNÓZ[ÜÚ[Û ÌÎNÈ [ÈÝXÝÙ]]J ÌÍÝÔÕK ÌÎNÙÓZ[ÜÚ[ÛÌÎNÊH [È [ÈÂBIÌÎNÐZ[[X ÌÎNÈ [ÈÝXÝÙ]]J ÌÍÝÔÕK ÌÎNÙÐZ[[XÌÎNÊH [È [ÈÂBIÌÎNÔ]ÜHQ ÌÎNÈ [ÈÝXÝÙ]]J ÌÍÝÔÕK ÌÎNÙÔ]ÜRY ÌÎNÊH [È [ÈÂBIÌÎNÐÔÑÚ[Û ÌÎNÈ [ÈÝXÝÙ]]J ÌÍÝÔÕK ÌÎNÜÞÔÑÚ[ÛÌÎNÊH [ÈBBPÛÛÛÛUÜ]J ÌÍÜÓÙÊB[ÙBPÛÛÛÛUÜ]J ÌÎNÊ ÌL×ËÊIÌÎNÈ [È [È ÌÎNÊ×ÓÊIÌÎNÈ [È [È ÌÎNÊ ÌÎNÉÌÎNÊJ ÌÎNÉÌÎNÊIÌÎNÈ [ÈB[YÌÍÝÔÕHH I still don't know how to get the 2002...? Maybe it's fix so XP is 2002 and Vista is always 200X? Edited April 4, 2009 by Authenticity
john123 Posted April 4, 2009 Author Posted April 4, 2009 (edited) Thanks Authenticity so much. Have a nice day. Edited April 4, 2009 by john123
john123 Posted April 4, 2009 Author Posted April 4, 2009 Hi Authenticity and everyone. I complie two script above. I run mini-setup with sysprep.exe and add them to sysprep.inf (run after mini-setup - with Runonce). The second script run fine but first script don't run. I think first script don't work with SYSTEM account (after mini-setup, windows login as System account). Can you explain about this problem? Sorry for bother. Thank you so much.
trancexx Posted April 4, 2009 Posted April 4, 2009 Run it like this (unless some "obj" guy wouldn't be faster to elaborate before): $oError = ObjEvent("AutoIt.Error", "_ErrFunc") Dim $oWMI = ObjGet('winmgmts:{impersonationLevel=impersonate}!//./root/cimv2') Dim $oOSs = $oWMI.InstancesOf('Win32_OperatingSystem') For $oOS In $oOSs ConsoleWrite($oOS.Caption & @TAB & $oOS.Version & @LF) Next Func _ErrFunc() ;FileWrite("MyWMILog.txt", "Error is: " & Ptr($oError.Number)) MsgBox(0, "WMI Error", "Error is: " & Ptr($oError.Number)) EndFunc Or just wait for someone smarter Btw, no bunny is quite ok with me. ♡♡♡ . eMyvnE
john123 Posted April 5, 2009 Author Posted April 5, 2009 (edited) Thanks Trancexx. I've just tested. I got error message : 0x8004100A. Perhap WMI don't run until full operating system installed (for user account, don't include SYSTEM account). I really need phrase "Microsoft windows xp professional" to make a label on my application, this application run after mini-setup. How can fix this error?. Edited April 5, 2009 by john123
trancexx Posted April 5, 2009 Posted April 5, 2009 Thanks Trancexx. I've just tested. I got error message : 0x8004100A. Perhap WMI don't run until full operating system installed (for user account, don't include SYSTEM account). I really need phrase "Microsoft windows xp professional" to make a label on my application, this application run after mini-setup. How can fix this error?.Description for that error is: WBEM_E_CRITICAL_ERROR 0x8004100A An internal, critical, and unexpected error occurred. Report this error to Microsoft Technical Support. ♡♡♡ . eMyvnE
rajeshontheweb Posted April 5, 2009 Posted April 5, 2009 i am not sure, i am not deep into windows api programming but would it not be possible to use it with winapi.au3 ?here's a link which explains retrieval of Build number (which is actually not solving our purpose btw) http://support.microsoft.com/kb/188987 Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
trancexx Posted April 5, 2009 Posted April 5, 2009 You have all that as AutoIt's macros and Authenticity posted an alternative call. ♡♡♡ . eMyvnE
rajeshontheweb Posted April 5, 2009 Posted April 5, 2009 (edited) WinAPI - Structure - OSVersionInfo hoooray, i might have got it , pls check if u can find out how to use it : WinAPI -Function - IsOS - very detailed info on usage here: IsOS @ geoffchappellSyntax BOOL IsOS( DWORD dwOS ); OS_NT 1 OS_PROFESSIONAL 20<edit>trancexx, i had earlier checked and rechecked it doesnt tell OS Edition, or i have overlooked at something. i checked these: @OS - Arch, Build, Version, ServicePack, Lang none of these return the OS Edition. Edited April 5, 2009 by rajeshontheweb Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
trancexx Posted April 5, 2009 Posted April 5, 2009 Try this before (it's a modification of Authenticity's - see the bunny): expandcollapse popupGlobal $tOSVI = DllStructCreate("dword OSVersionInfoSize;" & _ "dword MajorVersion;" & _ "dword MinorVersion;" & _ "dword BuildNumber;" & _ "dword PlatformId;" & _ "char CSDVersion[128];" & _ "ushort ServicePackMajor;" & _ "ushort ServicePackMinor;" & _ "ushort SuiteMask;" & _ "ubyte ProductType;" & _ "ubyte") DllStructSetData($tOSVI, "OSVersionInfoSize", DllStructGetSize($tOSVI)) Global $acall = DllCall("kernel32.dll", "int", "GetVersionEx", "ptr", DllStructGetPtr($tOSVI)) If Not @error Then Global $sMsg = "Major Version: " & DllStructGetData($tOSVI, "MajorVersion") & @LF & _ "Minor Version: " & DllStructGetData($tOSVI, "MinorVersion") & @LF & _ "Build Number: " & DllStructGetData($tOSVI, "BuildNumber") & @LF & _ "Platform ID: " & DllStructGetData($tOSVI, "PlatformId") & @LF & _ "CSDVersion: " & DllStructGetData($tOSVI, "CSDVersion") & @LF & _ "ServicePackMajor: " & DllStructGetData($tOSVI, "ServicePackMajor") & @LF & _ "ServicePackMinor: " & DllStructGetData($tOSVI, "ServicePackMinor") & @LF & _ "SuiteMask: " & DllStructGetData($tOSVI, "SuiteMask") & @LF & _ "ProductType: " & DllStructGetData($tOSVI, "ProductType") & @LF ConsoleWrite($sMsg) Else ConsoleWrite("(\_/)" & @LF & "(o_O)" & @LF & "('')('')" & @LF) EndIf If DllStructGetData($tOSVI, "PlatformId") = 2 Then If DllStructGetData($tOSVI, "MajorVersion") = 5 And DllStructGetData($tOSVI, "MinorVersion") = 1 And DllStructGetData($tOSVI, "ProductType") = 1 Then ConsoleWrite("! Windows XP") If Not BitAND(DllStructGetData($tOSVI, "SuiteMask"), 512) Then ConsoleWrite(" Professional" & @CRLF) Else ConsoleWrite(@CRLF) EndIf EndIf EndIf ♡♡♡ . eMyvnE
rajeshontheweb Posted April 5, 2009 Posted April 5, 2009 (edited) Oh Great, thats very handy. so, GetVersionEx itself gives us the info??? anyways, IsOS also works well only if u give the right parameters returned by GetVersionEx. The IsOS function asks first to have an OSVERSIONINFOEXA structure filled, and failing that, an OSVERSIONINFOA structure. ooh, as usual, it depends on how technical u can search for information. i checkedup this suitemask and this interesting thing came up: ; VER_SUITE_SMALLBUSINESS = 1 = 0x00000001 ; VER_SUITE_ENTERPRISE = 2 = 0x00000002 ; VER_SUITE_BACKOFFICE = 4 = 0x00000004 ; VER_SUITE_COMMUNICATIONS = 8 = 0x00000008 ; VER_SUITE_TERMINAL = 16 = 0x00000010 ; VER_SUITE_SMALLBUSINESS_RESTRICTED = 32 = 0x00000020 ; VER_SUITE_EMBEDDEDNT = 64 = 0x00000040 ; VER_SUITE_DATACENTER = 128 = 0x00000080 ; VER_SUITE_SINGLEUSERTS = 256 = 0x00000100 ; VER_SUITE_PERSONAL = 512 = 0x00000200 ; VER_SUITE_BLADE = 1024 = 0x00000400 ; To test properly for any flavor of WinXP, the following must be true: ; The PlatformID must be 2 [NT platform family] ; The O.S. Major Version must be 5. ; The O.S. Minor Version must be 1. ; The Product Type must be 1 [workstation, not server] ; If the result of (VerSuite & 512) is non-zero then that indicates that WinXP Home Edition is ; being used. If (VerSuite & 512) is zero then WinXP Professional Edition is being used. PS: I hope i can quote such snippets here is it within the forum rules pls correct me whenever i go wrong thanks a lot. <edited again> just more thought into it, above serves our purpose, but still, i think IsOS() would give us more precise and to the point answer - isnt it true? (this is to clarify my understanding) (Logic as i've understood) If IsOS(WIN_NT) Not False & IsOS(OS_Professional) Not False Then <WINDOWS XP PROFESSIONAL> Edited April 5, 2009 by rajeshontheweb Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
trancexx Posted April 5, 2009 Posted April 5, 2009 Oh Great, thats very handy. so, GetVersionEx itself gives us the info??? anyways, IsOS also works well only if u give the right parameters returned by GetVersionEx.That is done internally. You can use it like this maybe: $aCall = DllCall("shlwapi.dll", "int", 437, "dword", 20); 437 is the function (exported by ordinal) ConsoleWrite($aCall[0] & @CRLF) Description for 20 is: The program is running on Windows NT Workstation or Windows 2000 (or one of its successors) Professional. ♡♡♡ . eMyvnE
john123 Posted April 5, 2009 Author Posted April 5, 2009 Try this before (it's a modification of Authenticity's - see the bunny): expandcollapse popupGlobal $tOSVI = DllStructCreate("dword OSVersionInfoSize;" & _ "dword MajorVersion;" & _ "dword MinorVersion;" & _ "dword BuildNumber;" & _ "dword PlatformId;" & _ "char CSDVersion[128];" & _ "ushort ServicePackMajor;" & _ "ushort ServicePackMinor;" & _ "ushort SuiteMask;" & _ "ubyte ProductType;" & _ "ubyte") DllStructSetData($tOSVI, "OSVersionInfoSize", DllStructGetSize($tOSVI)) Global $acall = DllCall("kernel32.dll", "int", "GetVersionEx", "ptr", DllStructGetPtr($tOSVI)) If Not @error Then Global $sMsg = "Major Version: " & DllStructGetData($tOSVI, "MajorVersion") & @LF & _ "Minor Version: " & DllStructGetData($tOSVI, "MinorVersion") & @LF & _ "Build Number: " & DllStructGetData($tOSVI, "BuildNumber") & @LF & _ "Platform ID: " & DllStructGetData($tOSVI, "PlatformId") & @LF & _ "CSDVersion: " & DllStructGetData($tOSVI, "CSDVersion") & @LF & _ "ServicePackMajor: " & DllStructGetData($tOSVI, "ServicePackMajor") & @LF & _ "ServicePackMinor: " & DllStructGetData($tOSVI, "ServicePackMinor") & @LF & _ "SuiteMask: " & DllStructGetData($tOSVI, "SuiteMask") & @LF & _ "ProductType: " & DllStructGetData($tOSVI, "ProductType") & @LF ConsoleWrite($sMsg) Else ConsoleWrite("(\_/)" & @LF & "(o_O)" & @LF & "('')('')" & @LF) EndIf If DllStructGetData($tOSVI, "PlatformId") = 2 Then If DllStructGetData($tOSVI, "MajorVersion") = 5 And DllStructGetData($tOSVI, "MinorVersion") = 1 And DllStructGetData($tOSVI, "ProductType") = 1 Then ConsoleWrite("! Windows XP") If Not BitAND(DllStructGetData($tOSVI, "SuiteMask"), 512) Then ConsoleWrite(" Professional" & @CRLF) Else ConsoleWrite(@CRLF) EndIf EndIf EndIf I tested. Everything done. Code work fine. I love AutoIT and this forum. Thanks you very much. Good luck to you. John123.
trancexx Posted April 5, 2009 Posted April 5, 2009 That's great! Don't forget to recycle your bottles, cans, and paper products. Use public transport and only recycled computer paper (if it's not recycled refuse to use it and just throw it away). ♡♡♡ . eMyvnE
yehia Posted April 5, 2009 Posted April 5, 2009 yeah be good! My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine
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