DreamOn Technical Blog

Tag: windows

VBscript: Check OS Version Information and Detect 32-bit or 64-bit Windows

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>

Windows Anti-Virus Exclusion List

If you ever need it here are the links where you can find what AntiVirus Exclusions you want to configure for your Windows Server.


Enterprise Configuration Recommendations:

Windows:

  • KB822158 Virus scanning recommendations for Enterprise computers that are running currently supported versions of Windows

Windows / Active Directory:

Cluster:

Forefront: Considerations when using antivirus software on FF Edge Products

FRS:

SQL:

IIS:

DHCP:

SCOM / MOM:

Config Manager 2007:

Hyper-V:

Exchange:

SharePoint:

SMS:

ISA:

Windows Update:

SBS:

MED-V

System Center:

Data Protection Manager:

App-V

Source: http://social.technet.microsoft.com/wiki/contents/articles/953.aspx

© 2024 BioliZards.be

Theme by Anders NorenUp ↑