Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to check if the OS is 64 bit or 32 bit?

339 views
Skip to first unread message

Gugle

unread,
Jan 13, 2009, 11:16:51 AM1/13/09
to
Hi all,
I want to check if the OS is 64 bit or 32 bit using vbscript. I'm
currently reading the registry key - HKEY_LOCAL_MACHINE\SYSTEM
\CurrentControlSet\Control\Session Manager\Environment
\PROCESSOR_ARCHITECTURE and checking the architecture. My question is
- Will this return the architecture of the OS or the architecture of
the processor? i.e., if a 32-bit Windows OS is installed on 64 bit
Processor, what will this return?

Thanks in advance for your help!

Richard Mueller [MVP]

unread,
Jan 13, 2009, 11:47:00 AM1/13/09
to

"Gugle" <gugle...@gmail.com> wrote in message
news:86d06b46-12bb-47b5...@w1g2000prm.googlegroups.com...

Mine shows "x86" or that registry setting. I have AMD Turion 64 X2 TL-56
with 32-bit Vista.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


Richard Mueller [MVP]

unread,
Jan 13, 2009, 11:57:07 AM1/13/09
to

"Richard Mueller [MVP]" <rlmuelle...@ameritech.nospam.net> wrote in
message news:uiupR6Zd...@TK2MSFTNGP03.phx.gbl...

You should be able to use the Win32_Processor class of WMI. For example:
===========
Option Explicit

Dim strComputer, objWMIService, colSettings, objProcessor

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
& strComputer & "\root\cimv2")

Set colSettings = objWMIService.ExecQuery _
("SELECT * FROM Win32_Processor")

For Each objProcessor In colSettings
Wscript.Echo "System Type: " & objProcessor.Architecture
Wscript.Echo "Processor: " & objProcessor.Description
Next
======
You can parse objProcessor.Description for "x64" to check for 64-bit (or
"x86" for 32-bit). The system type (objProcessor.Architure) returns 9 on my
machine, but I need to research what the number means.

Gugle

unread,
Jan 14, 2009, 3:04:35 AM1/14/09
to
On Jan 13, 9:57 pm, "Richard Mueller [MVP]" <rlmueller-
nos...@ameritech.nospam.net> wrote:
> "Richard Mueller [MVP]" <rlmueller-nos...@ameritech.nospam.net> wrote in
> messagenews:uiupR6Zd...@TK2MSFTNGP03.phx.gbl...
>
>
>
>
>
> > "Gugle" <gugle.ru...@gmail.com> wrote in message

> >news:86d06b46-12bb-47b5...@w1g2000prm.googlegroups.com...
> >> Hi all,
> >> I want to check if the OS is 64 bit or 32 bit using vbscript. I'm
> >> currently reading the registry key - HKEY_LOCAL_MACHINE\SYSTEM
> >> \CurrentControlSet\Control\Session Manager\Environment
> >> \PROCESSOR_ARCHITECTURE and checking the architecture. My question is
> >> - Will this return the architecture of the OS or the architecture of
> >> the processor? i.e., if a 32-bit Windows OS is installed on 64 bit
> >> Processor, what will this return?
>
> >> Thanks in advance for your help!
>
> > Mine shows "x86" or that registry setting. I have AMD Turion 64 X2 TL-56
> > with 32-bit Vista.
>
> > --
> > Richard Mueller
> > MVP Directory Services
> > Hilltop Lab -http://www.rlmueller.net

> > --
>
> You should be able to use the Win32_Processor class of WMI. For example:
> ===========
> Option Explicit
>
> Dim strComputer, objWMIService, colSettings, objProcessor
>
> strComputer = "."
>
> Set objWMIService = GetObject("winmgmts:" _
>     & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
>     & strComputer & "\root\cimv2")
>
> Set colSettings = objWMIService.ExecQuery _
>     ("SELECT * FROM Win32_Processor")
>
> For Each objProcessor In colSettings
>     Wscript.Echo "System Type: " & objProcessor.Architecture
>     Wscript.Echo "Processor: " & objProcessor.Description
> Next
> ======
> You can parse objProcessor.Description for "x64" to check for 64-bit (or
> "x86" for 32-bit). The system type (objProcessor.Architure) returns 9 on my
> machine, but I need to research what the number means.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab -http://www.rlmueller.net
> --

Thanx a ton Richard! That was really helpful.

0 new messages