PLEASE remember that creating the registry entry for the processor architecture is just a band-aid for the entire Win32_Environment provider failing! You might be able to get past the initial install, but you're likely to see issues later down the road. The root cause of this problem is that MS increased the max path from 1023 characters (+1 control character) to 2048 chars total. Unfortunately, they forgot to update WMI when they did this.
If your server's system path variable (not your user path variable) is longer than 1023 characters, you'll see the problem. The best workaround is to shorten the path by modifying it to use 8.3 file name syntax instead of long file names (use dir /x to see short file names). No reboot required, no services to restart. This issue has been resolved in Windows Server 2008. I'm currently pushing Microsoft to backport the fix to 2003, but no promises yet.
Here is code to reproduce the problem at will (sorry about the line wrapping). That emoticon should actually be ": S" without a space.
Set WshShell = WScript.CreateObject("WScript.Shell")
Found=False
strComputer="localhost"
SavePath="save your current path here"
'**********************************************************************************************
'Break it
'**********************************************************************************************
const HKEY_LOCAL_MACHINE = &H80000002
' Clear used vars
oReg = ""
' Fetch WMI registry objects
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\defaulttdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
strValueName = "Path"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,PathValue
wscript.echo "Path was: " & len(PathValue) & " bytes"
while len(PathValue)<1024
PathValue=PathValue & ";" & PathValue
wend
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,PathValue
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,PathValue
wscript.echo "Path is now: " & len(PathValue) & " bytes"
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colWMIQuery = objWMI.ExecQuery ("Select * from Win32_Environment where NAME = 'PROCESSOR_ARCHITECTURE'")
For each objProc in colWMIQuery
Found=True
Next
Set colWMIQuery=Nothing
Set objWMI=Nothing
If Found then
wscript.echo "Win32_Environment is working" & vbCRLF
Else
wscript.echo "Win32_Environment is NOT working" & vbCRLF
End If
'**********************************************************************************************
'Fix it
'**********************************************************************************************
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,SavePath
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,PathValue
wscript.echo "Path restored to: " & len(PathValue) & " bytes"
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colWMIQuery = objWMI.ExecQuery ("Select * from Win32_Environment where NAME = 'PROCESSOR_ARCHITECTURE'")
For each objProc in colWMIQuery
Found=True
Next
Set colWMIQuery=Nothing
Set objWMI=Nothing
If Found then
wscript.echo "Win32_Environment is working"
Else
wscript.echo "Win32_Environment is NOT working"
End If