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.

Thanks

CheckWindowsInstallerReady

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
	Next

End Function

Open in new window

bondy666Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

winstonepCommented:
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.
0
bondy666Author Commented:
OK, seem to have found the cause. Although the Installer key exists under SOFTWARE\Microsoft\Windows\CurrentVersion\Installer
 and under
 SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Installer

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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
0
bondy666Author Commented:
Fixed the problem
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.