vbScript: Quickly determine architecture

I’ve been using a rou­tine to deter­mine 64-bit v 32-bit work­sta­tions for some time check­ing the reg­istry for the PROCESSOR_ARCHITECTURE in the HKLM­SYS­TEM­Cur­rent­Con­trolSet­Con­trolSes­sion Man­agerEn­vi­ron­ment path. How­ev­er, this was prov­ing to be error prone. So, I just gave up that method alto­geth­er since all Win­dows x64 edi­tions have a “%SystemDrive%Program Files (x86)” direc­to­ry. This makes it just a quick and easy call the folderex­ists method of the filesys­te­mob­ject.

The only down­side is that can’t be used remote­ly but since most of my scripts are used in local poli­cies, this should­n’t be an issue.


Private Function is64bit()
	Dim filesys : Set filesys = CreateObject("Scripting.FileSystemObject")
	Dim bln64bit : bln64bit = False
	If filesys.FolderExists("C:Program Files (x86)") then bln64bit = True
	is64bit = bln64bit
End Function