Sub Force32Bit() 'If OS is 64 bit and the script engine is also 64 bit, re-run the script with a 32-bit engine Dim ws, fs, wmi, col, obj, strBits, strCmd, intArg 'Use WMI to see whether OS is 32 or 64 bit strBits = "32" On Error Resume Next Set wmi = GetObject("winmgmts:\\.\root\CIMV2") Set col = wmi.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", 48) For Each obj In col strBits = obj.OSArchitecture Next Set col = Nothing Set wmi = Nothing On Error Goto 0 'Test to see if we're on a 64-bit OS and running a 64-bit script engine If InStr(strBits, "64") <> 0 Then If Instr(WScript.FullName, "SysWOW64") = 0 Then 'Start building the necessary command line to re-launch the script Set ws = CreateObject("Wscript.Shell") Set fs = CreateObject("Scripting.FileSystemObject") strCmd = fs.BuildPath(fs.GetSpecialFolder(0), "SysWOW64\" & fs.GetFileName(WScript.FullName)) 'Add quotes in case engine has spaces in the path If Left(strCmd, 1) <> """" Then strCmd = """" & strCmd & """" End If 'Add the script name (with quotes just in case) strCmd = strCmd & " """ & WScript.ScriptFullName & """" 'Add arguments if there are any If WScript.Arguments.Count > 0 Then For intArg = 0 To WScript.Arguments.Count - 1 'If there is a space in an argument, add quotes around the argument If InStr(WScript.Arguments(intArg), " ") <> 0 Then strCmd = strCmd & " """ & WScript.Arguments(intArg) & """" Else strCmd = strCmd & " " & WScript.Arguments(intArg) End If Next End If 'Run the script again with the 32-bit engine. Kill this 64-bit script. ws.Run strCmd, 1, False WScript.Quit End If End If End Sub