32 or 64 bit version of product: 64
Operating system: Windows 7 SP1 // Windows 10
32 or 64 bit OS: 64-bit
I have run into a bug where when running an executable I created with the below code on a 64-bit machine the below code writes to the WOW6432Node hive instead of the hive indicated. When executed line-by-line via PowerShell it works without an issue, only after it's an EXE do I have this issue.
I need the key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MyCompanyName\PCID
but it's checking and creating the key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MyCompanyName\PCID
The package target is Microsoft Windows 32 Bit // SAPIEN PowerShell V3 Host (Windows Forms). This works fine on 32 Bit machines but writes to the WOW6432Node on 64 Bit machines even though I am not telling it to write there.
Code: Select all
Add-Type -AssemblyName PresentationFramework
Set-Location HKLM:\
If (Test-Path HKLM:\SOFTWARE\Microsoft\CompanyName\PCID) {
$InstalledReason = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\CompanyName\PCID' -Name "InstalledReason" | Select-Object InstalledReason
$textbox1.Text = $InstalledReason.InstalledReason
} else {
Set-Location HKLM:\
If (!(Test-Path HKLM:\SOFTWARE\Microsoft\CompanyName)) {
Set-Location .\SOFTWARE\Microsoft
New-Item -Name CompanyName
}
Set-Location HKLM:\
If (!(Test-Path HKLM:\SOFTWARE\Microsoft\CompanyName\PCID)) {
Set-Location .\SOFTWARE\Microsoft\CompanyName
New-Item -Name PCID
}
[System.Windows.MessageBox]::Show("Did not find a current Installed Reason", "CompanyName Purpose of Depoyment Tool")