I have not had any trouble using Check Registry before, but with this particular key I am searching for, I always get the return value NO$VALUE even if the key does not exist. I just want to check for the key's existence so I am using Check Registry and leaving the Value field blank. I've also tried using Read Registry and picking a Value from the key to check for, but this always returns empty even if the key and value do exist.
For an example, I need to check if a program is installed by verifying the product GUID exists in the following path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Say for example, I'm looking for Microsoft .NET Framework 4.5, the GUID is: {92FB6C44-E685-45AD-9B20-CADF4CABA132}
My InstallAware code would be (copied data):
~InstallAware Clipboard Data~
~Check Registry~
~{834FE6AC-9ED5-417C-A019-793E6BD78176}~
~net4.5_check_installed~
~2~
~SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{92FB6C44-E685-45AD-9B20-CADF4CABA132}~
~~
The returned value is always NO$VALUE regardless of whether that key is actually there or not. If it's not there, I would expect it to return NO$KEY. Is there a limitation on the length that Check/Read Registry can do? Or are there reserved characters I need to escape like the curly braces?
Any advice would be greatly appreciated as to why this doesn't work.
Check Registry problem with GUID
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Check Registry problem with GUID
Dear ru2,
to check for the installed .Net version you should use the following regkey instead;
- HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP
For example, to check for the installed .Net 4 version you should read the value of "Version" key under;
- HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
That said, do not forget to consider that by default the setup process runs Always under 32 bit mode.
So if your target is a x64 system, the setup process has to be switched to x64 mode in order to be able to query any registry key under "HKLM\SOFTWARE". Otherwise any call will be re-directed by default to the respective "HKLM\SOFTWARE\Wow6432Node" key.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa384232(v=vs.85).aspx
Finally, to correctly check for the installed .Net version and regardless of the target OS Platform (x86/x64), your script code should be;
Hope this helps you.
Regards
to check for the installed .Net version you should use the following regkey instead;
- HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP
For example, to check for the installed .Net 4 version you should read the value of "Version" key under;
- HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
That said, do not forget to consider that by default the setup process runs Always under 32 bit mode.
So if your target is a x64 system, the setup process has to be switched to x64 mode in order to be able to query any registry key under "HKLM\SOFTWARE". Otherwise any call will be re-directed by default to the respective "HKLM\SOFTWARE\Wow6432Node" key.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa384232(v=vs.85).aspx
Finally, to correctly check for the installed .Net version and regardless of the target OS Platform (x86/x64), your script code should be;
Code: Select all
Set Variable DOTNET4_VERSION to
Get System Setting Windows in 64 bit Mode into ISWINDOWS64BIT
if Variable ISWINDOWS64BIT Equals TRUE
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
end
Read Registry Key HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Version into DOTNET4_VERSION
if Variable ISWINDOWS64BIT Equals TRUE
Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
end
MessageBox: $TITLE$, My .Net version = $DOTNET4_VERSION$
Code: Select all
~InstallAware Clipboard Data~
~MessageBox~
~{D0AA2E0F-F51D-4595-BF9B-E1DCF84C519F}~
~$TITLE$~
~My .Net version = $DOTNET4_VERSION$~
~0~
~1~
~~
~Comment~
~{96037E03-F62E-4AE3-B76D-79C736B5A43F}~
~~
~End~
~{2AC17463-A5B2-4CC7-907C-20BA2DA9F10E}~
~Set 64 Bit Mode~
~{99F713C7-976F-4C3D-A20A-687BD9FBC228}~
~TRUE~
~FALSE~
~FALSE~
~If~
~{43BDDBFC-8ECF-479E-B9CA-368A4D98709E}~
~ISWINDOWS64BIT~
~0~
~TRUE~
~FALSE~
~Read Registry~
~{A63001D1-3C29-41BA-8967-C191B0178CB2}~
~DOTNET4_VERSION|~
~2~
~SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full~
~Version~
~End~
~{6F0F716D-580F-44E1-9171-D827F2362CCE}~
~Set 64 Bit Mode~
~{21847843-5C3B-4304-BD1E-0BE8680AF73A}~
~FALSE~
~FALSE~
~TRUE~
~If~
~{C0BF6F2A-26AF-4552-86FC-FE99566E43A6}~
~ISWINDOWS64BIT~
~0~
~TRUE~
~FALSE~
~Get System Settings~
~{1EAF1261-EB11-47EA-891C-A2E0622DFFEB}~
~ISWINDOWS64BIT~
~65~
~Set Variable~
~{ECC14196-1E2E-4F6C-8BF7-6E92F8EBCD0D}~
~DOTNET4_VERSION$MYAH$MYAH$FALSE~
~~
Hope this helps you.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Check Registry problem with GUID
Thank you for the response!
.NET being installed was just an example, I know to check for it elsewhere, but my issue was checking that specific Uninstall key with the GUID. I'm not actually checking for .NET but just a Windows program that is installed which are listed under that key and the only way I know to check in the registry that they are installed. I just figured .NET would be a good example GUID for others to test with.
Anyway, I think you may be on to something with the target system. The program I'm looking for could be installed as either 32-bit or 64-bit on a 64-bit system, so I've adjusted the code to the following:
The first check is done in whatever the native mode is (either Win32 or x64 depending on the system, set previously in the script) and the second check is done in Win32 mode in case it's a 64-bit machine and the user installed the program I'm looking for as 32-bit. On the machine I'm testing, the mode is set to x64 by default so the first check is done in x64 and the second check is done in Win32.
Unfortunately, I am still getting the same results. Both results are returning NO$VALUE, indicating the key exists, but it is not possible for this program to be installed as both 32-bit and 64-bit and I have verified on the machine that the key only exists in the 64-bit location. I have also tried changing the second check (32-bit check) to Check Registry Key HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{38C5644C-290B-492C-A001-1DD58C29E84C}\ into check_32_installed (adding the Wow6432Node because that's how the path actually looks), but it still didn't change the results.
I hope this explains my issue more thoroughly and that you may have another suggestion.
.NET being installed was just an example, I know to check for it elsewhere, but my issue was checking that specific Uninstall key with the GUID. I'm not actually checking for .NET but just a Windows program that is installed which are listed under that key and the only way I know to check in the registry that they are installed. I just figured .NET would be a good example GUID for others to test with.
Anyway, I think you may be on to something with the target system. The program I'm looking for could be installed as either 32-bit or 64-bit on a 64-bit system, so I've adjusted the code to the following:
Code: Select all
Check Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{38C5644C-290B-492C-A001-1DD58C29E84C}\ into check_64_installed
if Variable 64BITWINDOWS Equals TRUE
Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
Check Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{38C5644C-290B-492C-A001-1DD58C29E84C}\ into check_32_installed
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
end
The first check is done in whatever the native mode is (either Win32 or x64 depending on the system, set previously in the script) and the second check is done in Win32 mode in case it's a 64-bit machine and the user installed the program I'm looking for as 32-bit. On the machine I'm testing, the mode is set to x64 by default so the first check is done in x64 and the second check is done in Win32.
Unfortunately, I am still getting the same results. Both results are returning NO$VALUE, indicating the key exists, but it is not possible for this program to be installed as both 32-bit and 64-bit and I have verified on the machine that the key only exists in the 64-bit location. I have also tried changing the second check (32-bit check) to Check Registry Key HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{38C5644C-290B-492C-A001-1DD58C29E84C}\ into check_32_installed (adding the Wow6432Node because that's how the path actually looks), but it still didn't change the results.
I hope this explains my issue more thoroughly and that you may have another suggestion.
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Check Registry problem with GUID
Dear ru2,
first of all your "Check Registry Key" looks to be wrong. It seems you just specified the target Registry path, while you missed the value that needs to be checked.
So supposing you want to verify the "version" key, this should be;
Otherwise it will never work.
In addition the approach described by your code snippet looks not correct! By default the setup runs in 32 bit mode and not in 64 bit mode.
This should be instead ( ...supposing to verify the "version" key);
Alternatively, in place of the "Check Registry" you may use "Is MSI Setup Installed". This command only wants the Product Code (Guid) as parameter. Of course ... the same x86/x64 approach still needs to be used.
Hope this helps you.
Regards
first of all your "Check Registry Key" looks to be wrong. It seems you just specified the target Registry path, while you missed the value that needs to be checked.
So supposing you want to verify the "version" key, this should be;
Code: Select all
Check Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{38C5644C-290B-492C-A001-1DD58C29E84C}\Version into check_64_installed
Otherwise it will never work.
In addition the approach described by your code snippet looks not correct! By default the setup runs in 32 bit mode and not in 64 bit mode.
This should be instead ( ...supposing to verify the "version" key);
Code: Select all
Set Variable check_64_installed to FALSE
Set Variable check_32_installed to FALSE
Check Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{38C5644C-290B-492C-A001-1DD58C29E84C}\Version into check_32_installed
Get System Setting Windows in 64 bit Mode into ISWINDOWS64BIT
if Variable ISWINDOWS64BIT Equals TRUE
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
Check Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{38C5644C-290B-492C-A001-1DD58C29E84C}\Version into check_64_installed
Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
end
MessageBox: $TITLE$, check_64_installed = $check_64_installed$$NEWLINE$check_32_installed = $check_32_installed$
Code: Select all
~InstallAware Clipboard Data~
~MessageBox~
~{60E46034-16FA-4166-B7E6-B58821510C8D}~
~$TITLE$~
~check_64_installed = $check_64_installed$$NEWLINE$check_32_installed = $check_32_installed$~
~0~
~1~
~~
~Comment~
~{CB2D7B48-7796-4D37-B147-81D906AB26C3}~
~~
~End~
~{96CB39F9-9B52-40D6-BA11-1441A3ECBE58}~
~Set 64 Bit Mode~
~{C2BC030D-5C97-4221-93D6-2547EADB2F3D}~
~TRUE~
~FALSE~
~FALSE~
~Check Registry~
~{16CF4000-AE79-4EE6-AC71-F898F227DFCF}~
~check_64_installed|~
~2~
~SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{38C5644C-290B-492C-A001-1DD58C29E84C}~
~Version~
~Set 64 Bit Mode~
~{62FE5534-1513-41E9-B061-AE96EAADED1B}~
~FALSE~
~FALSE~
~TRUE~
~If~
~{450F78F6-06DE-418C-BCE2-4E7EDEF36A30}~
~ISWINDOWS64BIT~
~0~
~TRUE~
~FALSE~
~Get System Settings~
~{54012602-7451-497B-9BAE-006C61FCFD7C}~
~ISWINDOWS64BIT~
~65~
~Comment~
~{BA7AF87C-18D9-44AC-A2EF-ABD3F11AAC9A}~
~~
~Check Registry~
~{6DDFC689-109A-4660-A7E8-9986E914E5F3}~
~check_32_installed|~
~2~
~SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{38C5644C-290B-492C-A001-1DD58C29E84C}~
~Version~
~Comment~
~{FE1FFE10-BDF0-4437-A8F1-F96E32EBF788}~
~~
~Set Variable~
~{D5B4D727-70E0-4B74-8478-A15E1F6958F8}~
~check_32_installed$MYAH$MYAH$FALSE~
~FALSE~
~Set Variable~
~{BB39DE4C-7ABD-493F-AF62-5C901320DCC0}~
~check_64_installed$MYAH$MYAH$FALSE~
~FALSE~
Alternatively, in place of the "Check Registry" you may use "Is MSI Setup Installed". This command only wants the Product Code (Guid) as parameter. Of course ... the same x86/x64 approach still needs to be used.
Hope this helps you.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Check Registry problem with GUID
The Check Registry command explicitly says to leave the value empty when you want to just check for the key itself (https://www.installaware.com/FlashHelp/ ... gistry.htm):
I have also tried checking an actual value in the key anyway but that doesn't make a difference.
And I know the default is 32-bit mode, I mentioned in my comment that the script sets it to 64-bit mode already. What I have written above is actually correct and what I want to check for. The program I am checking for is not the program I am installing. It is a completely separate program and it may have been installed as either 32-bit or 64-bit and I don't know which. So even though I am running my install in 64-bit mode, I want to check for the external program being installed as 32-bit mode. The code you suggested will not work for me.
However! I did not know about "Is MSI Setup Installed". This does exactly what I need and since checking with the registry keys is so hard to use and problematic I will use that function instead. Thanks very much for mentioning it!
Value
Type the value to read or check for. Leave empty to test for the existence of the key itself (and read the default value if the key exists).
I have also tried checking an actual value in the key anyway but that doesn't make a difference.
And I know the default is 32-bit mode, I mentioned in my comment that the script sets it to 64-bit mode already. What I have written above is actually correct and what I want to check for. The program I am checking for is not the program I am installing. It is a completely separate program and it may have been installed as either 32-bit or 64-bit and I don't know which. So even though I am running my install in 64-bit mode, I want to check for the external program being installed as 32-bit mode. The code you suggested will not work for me.
However! I did not know about "Is MSI Setup Installed". This does exactly what I need and since checking with the registry keys is so hard to use and problematic I will use that function instead. Thanks very much for mentioning it!
Who is online
Users browsing this forum: No registered users and 93 guests