A little script to check the version of the OS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | Set dtmConvertedDate = CreateObject( "WbemScripting.SWbemDateTime" ) strComputer = "." Set objWMIService = GetObject( "winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2" ) Set colOperatingSystems = objWMIService.ExecQuery _ ( "Select * from Win32_OperatingSystem" ) For Each objOperatingSystem in colOperatingSystems Wscript.Echo "Boot Device: " & objOperatingSystem.BootDevice Wscript.Echo "Build Number: " & objOperatingSystem.BuildNumber Wscript.Echo "Build Type: " & objOperatingSystem.BuildType Wscript.Echo "Caption: " & objOperatingSystem.Caption Wscript.Echo "Code Set: " & objOperatingSystem.CodeSet Wscript.Echo "Country Code: " & objOperatingSystem.CountryCode Wscript.Echo "Debug: " & objOperatingSystem.Debug Wscript.Echo "Encryption Level: " & objOperatingSystem.EncryptionLevel dtmConvertedDate.Value = objOperatingSystem.InstallDate dtmInstallDate = dtmConvertedDate.GetVarDate Wscript.Echo "Install Date: " & dtmInstallDate Wscript.Echo "Licensed Users: " & _ objOperatingSystem.NumberOfLicensedUsers Wscript.Echo "Organization: " & objOperatingSystem.Organization Wscript.Echo "OS Language: " & objOperatingSystem.OSLanguage Wscript.Echo "OS Product Suite: " & objOperatingSystem.OSProductSuite Wscript.Echo "OS Type: " & objOperatingSystem.OSType Wscript.Echo "Primary: " & objOperatingSystem.Primary Wscript.Echo "Registered User: " & objOperatingSystem.RegisteredUser Wscript.Echo "Serial Number: " & objOperatingSystem.SerialNumber Wscript.Echo "Version: " & objOperatingSystem.Version Next |
Detect 32-bit or 64-bit Windows
There are 2 options here
1 2 3 4 5 6 7 8 9 | Set WshShell = CreateObject( "WScript.Shell" ) OsType = WshShell.RegRead( "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE" ) If OsType = "x86" then wscript.echo & "Windows 32bit system detected" elseif OsType = "AMD64" then wscript.echo & "Windows 64bit system detected" end if |
A simpler and more correcter way would be
1 | wscript.echo GetObject( "winmgmts:root\cimv2:Win32_Processor='cpu0'" ).AddressWidth |
Putting this together in an Html Application (HTA) makes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | < html > < head > < title >Outlook ReProfiling ...</ title > < HTA:APPLICATION ID = "objHTAOutlReProfiling" APPLICATIONNAME = "OutlReProfiling" SCROLL = "no" SINGLEINSTANCE = "yes" WINDOWSTATE = "maximize" > </ head > < style type = "text/css" > div.centered{ display:block; position:absolute; top:5%; left:10%; width:80%; } </ style > < body > < div id = DataAreaNL > </ div > </ doby > < SCRIPT Language = "VBScript" > Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime") strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Boot Device: " & objOperatingSystem.BootDevice & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Build Number: " & objOperatingSystem.BuildNumber & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Build Type: " & objOperatingSystem.BuildType & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Caption: " & objOperatingSystem.Caption & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Code Set: " & objOperatingSystem.CodeSet & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Country Code: " & objOperatingSystem.CountryCode & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Debug: " & objOperatingSystem.Debug & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Encryption Level: " & objOperatingSystem.EncryptionLevel & "< br >" dtmConvertedDate.Value = objOperatingSystem.InstallDate dtmInstallDate = dtmConvertedDate.GetVarDate DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Install Date: " & dtmInstallDate & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Licensed Users: " & _ objOperatingSystem.NumberOfLicensedUsers & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Organization: " & objOperatingSystem.Organization & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"OS Language: " & objOperatingSystem.OSLanguage & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"OS Product Suite: " & objOperatingSystem.OSProductSuite & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"OS Type: " & objOperatingSystem.OSType & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Primary: " & objOperatingSystem.Primary & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Registered User: " & objOperatingSystem.RegisteredUser & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Serial Number: " & objOperatingSystem.SerialNumber & "< br >" DataAreaNL.InnerHTML=DataAreaNL.InnerHTML &"Version: " & objOperatingSystem.Version & "< br >" Next Set WshShell = CreateObject("WScript.Shell") OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE") If OsType = "x86" then DataAreaNL.InnerHTML=DataAreaNL.InnerHTML & "Windows 32bit system detected" & "< BR >" elseif OsType = "AMD64" then DataAreaNL.InnerHTML=DataAreaNL.InnerHTML & "Windows 64bit system detected" & "< BR >" end if DataAreaNL.InnerHTML=DataAreaNL.InnerHTML & GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth & "< BR >" </ SCRIPT > </ html > |
Recent Comments