[Codebox=powershell file=Untitled.ps1][/Codebox]
Hi! Need a little help -
When using PowerShell Studio 2016, I have a string setup like this:
$AddCoreApps = (Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\Deployment 4" -Name AddedCoreApps).AddedCoreApps
The value either comes back "yes" or "no". Once i compile it into an exe the value comes back null when trying to run the exe on Windows 7 x64 but works fine on Windows 7 x86.
code written in V2 32 and compiled using V2 Host (Windows Forms) win32
any help would be greatly appreciated
reg value lost once compiled
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: reg value lost once compiled
The value is not lost. Your 64 bit system actually has a 64 bit and 32 bit registry. (It is a little bit more complicated but it will suffice here)
If you access the value from the 32 bit exe it will get the value.
If you do the same from a 64 bit application it simply looks at the 64 bit place which is different.
Now, depending on your case, the return is correct for a 64 bit application or you need to ALWAYS access the 32 bit node.
If you access the value from the 32 bit exe it will get the value.
If you do the same from a 64 bit application it simply looks at the 64 bit place which is different.
Now, depending on your case, the return is correct for a 64 bit application or you need to ALWAYS access the 32 bit node.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: reg value lost once compiled
This might help:
https://gallery.technet.microsoft.com/s ... f18c8324c0
https://gallery.technet.microsoft.com/s ... f18c8324c0
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: reg value lost once compiled
Here are the base rules of registry reflection:
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
Re: reg value lost once compiled
That makes sense. Created an extra registry key in the 64-bit node reran the executable and the value returned yes. Thank you for all your help!