Unable to run stdRegProv WMI on x64 Windows XP

I run the attached script fine in an x86 environment and it also appears to work fine in an x64 environment if I change the strKeyPath variable to something other than I\CurrentVersion\Installer
However if I run as it is in the x64 environment I get an 'Object not a collection' error. This seems illogical. Does anyone know how to fix this and ideally why it happens for this particular key in the x64 environment? Incidentally, I have tried changing the path to the WOW6432Node but this doesn't work either.



Function CheckWindowsInstallerReady
	const HKEY_LOCAL_MACHINE = &H80000002
	Dim objRegistry: Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
	Dim strKeyPath: strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer"
	Dim arrSubKeys
	Dim Key
	objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
	CheckWindowsInstallerReady = true
	For Each Key In arrSubKeys
		if Key = "InProgress" then 'Windows Installer is busy
	    	CheckWindowsInstallerReady = false
		end if

End Function

Open in new window

Who is Participating?
bondy666Author Commented:
OK, seem to have found the cause. Although the Installer key exists under SOFTWARE\Microsoft\Windows\CurrentVersion\Installer
 and under

the actual keys differ and this seems to be causing the problem. If I populate the SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Installer
with the same keys and values as SOFTWARE\Microsoft\Windows\CurrentVersion\Installer
then the script completes as expected.
I have found XP64 to be un-reliable to say the least so this doesn't surprise me. Not sure what to do to fix it as I got so frustrated with XP64 I dumped it to use first vista and then 7 64bit.

I'll try to dig into this a bit more as I'm looking to work with the registry as well and post an update but this may not be for a few days.
bondy666Author Commented:
Following further testing, I have included a script at build time to copy the Installer x64 reg key to the Wow6432Node reg key and to my surprise this seems to have fixed the problem completely and everything works again as it should.
bondy666Author Commented:
Fixed the problem
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.