I'm writing a PowerShell script that modifies the registry and I'm wondering if I need to specify the bittness of the keys I'm trying to modify. I'm hoping someone can clear this up for me.
As I understand it, in 64-bit versions of Windows, portions of the registry are divided into 32-bit keys and 64-bit keys. This is a result of some 32-bit keys being virtualized (or reflected) into 64-bit keys for the sake of interoperability. The virtualized keys have different paths/names/values and cause problems when accessing the registry with 32-bit applications (on 64-bit machines).
But what about PowerShell?
I know there are 32 and 64-bit versions of PowerShell:
%systemroot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe (32) %systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe (64)
And also Regedit:
%systemroot%\syswow64\regedit.exe (32) %systemroot%\regedit.exe (64)
The 64-bit versions are the default. Is there any reason to use the 32-bit version?
As for scripting, is it simply a matter of knowing the bittness of the registry key in question and usingMicrosoft.Win32.RegistryView.Registry64 when needed? What if I need to modify registry entries for 32-bit applications that are installed on 64-bit machines?