A little script to check the version of the OS
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
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
wscript.echo GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth
Putting this together in an Html Application (HTA) makes:
<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>
Leave a Reply
You must be logged in to post a comment.