Wow6432Node clarification please

Hi!

My current packaging rhythm is using wrapping technologies that are natively x86 based (AutoIT, WISEScript). To modify the 64-bit registry view we use things like HKLM64 to get that that registry hive. How do I handle which registry view I am editing (native x64 view vs the 32-bit Wow6432Node)? I would sure hate to have separate code blocks using something like:


If ($Is64Bit) {
	Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Firefox\Crash Reporter' -Name 'SubmitCrashReport' -Value 0 -Type DWord
} Else {
	Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Firefox\Crash Reporter' -Name 'SubmitCrashReport' -Value 0 -Type DWord
}

As this is against how we are operating now…

Depends on the program. If you are installing a 32bit version then that program expects registry entries in a 32bit registry hive. On 64bit os they are in a different location so you either modify one or the other or both. The toolkit doesn’t assume this for you. So you would have to write an If statement for it. Only once would be enough though:

If ($Is64Bit) {
	$DefaultRegPath = 'HKEY_LOCAL_MACHINE\SOFTWARE'
} Else {
	$DefaultRegPath = 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node'
}

Set-RegistryKey -Key "$DefaultRegPath\Mozilla\Firefox\Crash Reporter" -Name 'SubmitCrashReport' -Value 0 -Type DWord

But of course you can just write a function for this as an extension of our toolkit and use it throughout your deployments.