Kace setting registry values around wow6432node
Is there any way in the kscript to set a registry value and not automatically redirect through the WOW6432NODE? Most of the time going through wow6432node is fine. But not this case.
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
KevinG
4 years ago
To access the 64bit HKEY_LOCAL_MACHINE you would use HKLM64 instead of the typical HKLM.
https://support.quest.com/kace-systems-management-appliance/kb/111236/how-to-use-windows-64bit-32bit-redirects
Comments:
-
This results in:
====
07/31/2020 13:00:47 - Scanning HKLM64:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
Get-ChildItem : Cannot find drive. A drive with the name 'HKLM64' does not exist.
At C:\ProgramData\Quest\KACE\scripts\1133\DeleteBomgar.ps1:37 char:1
+ Get-ChildItem $paths |
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKLM64:String) [Get-ChildItem], DriveNotFoundExcept
ion
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
====
I suspect this is because the 32-bit version of Powershell is being called, and it doesn't recognize the "HKLM64" nomenclature. The (seven-year old) article linked above eventually leads to this advice: "If you are executing against a x64 system you will want to call c:\windows\sysnative\powershell.exe to make sure you are executing the 64bit version of PowerShell...". Of course, that neutralizes version 10.2.234's new "we now run Powershell scripts directly" feature; perhaps a checkbox on Powershell scripts to select this option would be in order. - kentwest 4 years ago