HKLM Registry key values access using WQL
I am trying to access an application's version using it's product code.
We can achieve above using-
(Get-ItemProperty -path 'HKLM:SOFTWAREMicrosoftWindowsCurrentVersionUninstall{EC542D5D-B608-4145-12F7-749C02B23494}').displayversion
where EC542D5D-B608-4145-12F7-749C02B23494 is product Code.
But I have to write it as a WMI Query (needed for SCCM). SCUP is not accepting this query.
There are few other mechanisms but nothing works in fetching out the version.
Example -
1. PatchMyPC's catalog uses "path" attribute but in my case I need to fetch from Registry. So if I path as 'HKLM:SOFTWAREMicrosoft.......... it is giving error.
<bar:FileExists Path="7-Zip7zFM.exe" Csidl="38" />
<bar:FileVersion Path="7-Zip7zFM.exe" Comparison="LessThan" Version="18.01.0.0" Csidl="38" />
So I am not able to fetch version using Registry (HKLM Unsinstall path) which is also accepted ny SCUP.
PS Win32_product class takes lot of time, so that is avoided.
registry wmi sccm wql
add a comment |
I am trying to access an application's version using it's product code.
We can achieve above using-
(Get-ItemProperty -path 'HKLM:SOFTWAREMicrosoftWindowsCurrentVersionUninstall{EC542D5D-B608-4145-12F7-749C02B23494}').displayversion
where EC542D5D-B608-4145-12F7-749C02B23494 is product Code.
But I have to write it as a WMI Query (needed for SCCM). SCUP is not accepting this query.
There are few other mechanisms but nothing works in fetching out the version.
Example -
1. PatchMyPC's catalog uses "path" attribute but in my case I need to fetch from Registry. So if I path as 'HKLM:SOFTWAREMicrosoft.......... it is giving error.
<bar:FileExists Path="7-Zip7zFM.exe" Csidl="38" />
<bar:FileVersion Path="7-Zip7zFM.exe" Comparison="LessThan" Version="18.01.0.0" Csidl="38" />
So I am not able to fetch version using Registry (HKLM Unsinstall path) which is also accepted ny SCUP.
PS Win32_product class takes lot of time, so that is avoided.
registry wmi sccm wql
add a comment |
I am trying to access an application's version using it's product code.
We can achieve above using-
(Get-ItemProperty -path 'HKLM:SOFTWAREMicrosoftWindowsCurrentVersionUninstall{EC542D5D-B608-4145-12F7-749C02B23494}').displayversion
where EC542D5D-B608-4145-12F7-749C02B23494 is product Code.
But I have to write it as a WMI Query (needed for SCCM). SCUP is not accepting this query.
There are few other mechanisms but nothing works in fetching out the version.
Example -
1. PatchMyPC's catalog uses "path" attribute but in my case I need to fetch from Registry. So if I path as 'HKLM:SOFTWAREMicrosoft.......... it is giving error.
<bar:FileExists Path="7-Zip7zFM.exe" Csidl="38" />
<bar:FileVersion Path="7-Zip7zFM.exe" Comparison="LessThan" Version="18.01.0.0" Csidl="38" />
So I am not able to fetch version using Registry (HKLM Unsinstall path) which is also accepted ny SCUP.
PS Win32_product class takes lot of time, so that is avoided.
registry wmi sccm wql
I am trying to access an application's version using it's product code.
We can achieve above using-
(Get-ItemProperty -path 'HKLM:SOFTWAREMicrosoftWindowsCurrentVersionUninstall{EC542D5D-B608-4145-12F7-749C02B23494}').displayversion
where EC542D5D-B608-4145-12F7-749C02B23494 is product Code.
But I have to write it as a WMI Query (needed for SCCM). SCUP is not accepting this query.
There are few other mechanisms but nothing works in fetching out the version.
Example -
1. PatchMyPC's catalog uses "path" attribute but in my case I need to fetch from Registry. So if I path as 'HKLM:SOFTWAREMicrosoft.......... it is giving error.
<bar:FileExists Path="7-Zip7zFM.exe" Csidl="38" />
<bar:FileVersion Path="7-Zip7zFM.exe" Comparison="LessThan" Version="18.01.0.0" Csidl="38" />
So I am not able to fetch version using Registry (HKLM Unsinstall path) which is also accepted ny SCUP.
PS Win32_product class takes lot of time, so that is avoided.
registry wmi sccm wql
registry wmi sccm wql
edited Dec 18 '18 at 10:01
Erik von Asmuth
18.8k62038
18.8k62038
asked Dec 18 '18 at 9:55
Abby JangirAbby Jangir
239
239
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Because Win32_Product is generally a class that should be avoided SCCM introduces it's own classes for this purpose:
Win32Reg_AddRemovePrograms
Win32Reg_AddRemovePrograms64
It should be possible to query one of those like this
select Version from Win32Reg_AddRemovePrograms where ProdID = '{EC542D5D-B608-4145-12F7-749C02B23494}'
Hi @Syberdoor, thank you for your suggestion. The queries you have suggested do not give all the products installed. So if I try "gwmi -class win32-addremovePrograms" or gwmi -class win32-addremovePrograms64 it is not listing all the installed products
– Abby Jangir
Dec 26 '18 at 5:02
actually they should not give all the programs installed, one should be a inventory of hklmsoftwaremicrosoftwindowscurrentversionuninstall hklmsoftwarewow6432nodemicrosoftwindowscurrentversionuninstall so they show the installed respective per machine 32bit and 64bit programs. Which one you need depends on whether you use 64bit or 32bit 7zip. I think there was also a bug years ago where the 64bit one did not work properly but it should be fixed afaik
– Syberdoor
Dec 26 '18 at 10:07
add a comment |
SCUP uses the WSUS XML Schema specifically the BaseApplicabilityRules Schema. You can choose any of the Types documented on that page. They have different rules for different scenarios like WMI Query, file details, and registry queries among others. If you are looking for a version comparison from the registry the best choice would be RegSzToVersion
. Based on your question you would use something like
<bar:RegSzToVersion Key="HKEY_LOCAL_MACHINE" Subkey="SOFTWAREMicrosoftWindowsCurrentVersionUninstall{EC542D5D-B608-4145-12F7-749C02B23494}" Value="DisplayVersion" RegType32="false" Comparison="LessThan" Data="1.0.0.0" />
Comparison can be any of the following values
- LessThan
- LessThanOrEqualTo
- EqualTo
- GreaterThanOrEqualTo
- GreaterThan
RegType32 is, by default, false so you can leave it out if you choose. If the registry key is associated with a 32-bit entry, change that attribute to true or hardcode with the "WOW6432Node" path.
Data attribute is the target version number to compare against (in standard four part version number format).
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53830437%2fhklm-registry-key-values-access-using-wql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Because Win32_Product is generally a class that should be avoided SCCM introduces it's own classes for this purpose:
Win32Reg_AddRemovePrograms
Win32Reg_AddRemovePrograms64
It should be possible to query one of those like this
select Version from Win32Reg_AddRemovePrograms where ProdID = '{EC542D5D-B608-4145-12F7-749C02B23494}'
Hi @Syberdoor, thank you for your suggestion. The queries you have suggested do not give all the products installed. So if I try "gwmi -class win32-addremovePrograms" or gwmi -class win32-addremovePrograms64 it is not listing all the installed products
– Abby Jangir
Dec 26 '18 at 5:02
actually they should not give all the programs installed, one should be a inventory of hklmsoftwaremicrosoftwindowscurrentversionuninstall hklmsoftwarewow6432nodemicrosoftwindowscurrentversionuninstall so they show the installed respective per machine 32bit and 64bit programs. Which one you need depends on whether you use 64bit or 32bit 7zip. I think there was also a bug years ago where the 64bit one did not work properly but it should be fixed afaik
– Syberdoor
Dec 26 '18 at 10:07
add a comment |
Because Win32_Product is generally a class that should be avoided SCCM introduces it's own classes for this purpose:
Win32Reg_AddRemovePrograms
Win32Reg_AddRemovePrograms64
It should be possible to query one of those like this
select Version from Win32Reg_AddRemovePrograms where ProdID = '{EC542D5D-B608-4145-12F7-749C02B23494}'
Hi @Syberdoor, thank you for your suggestion. The queries you have suggested do not give all the products installed. So if I try "gwmi -class win32-addremovePrograms" or gwmi -class win32-addremovePrograms64 it is not listing all the installed products
– Abby Jangir
Dec 26 '18 at 5:02
actually they should not give all the programs installed, one should be a inventory of hklmsoftwaremicrosoftwindowscurrentversionuninstall hklmsoftwarewow6432nodemicrosoftwindowscurrentversionuninstall so they show the installed respective per machine 32bit and 64bit programs. Which one you need depends on whether you use 64bit or 32bit 7zip. I think there was also a bug years ago where the 64bit one did not work properly but it should be fixed afaik
– Syberdoor
Dec 26 '18 at 10:07
add a comment |
Because Win32_Product is generally a class that should be avoided SCCM introduces it's own classes for this purpose:
Win32Reg_AddRemovePrograms
Win32Reg_AddRemovePrograms64
It should be possible to query one of those like this
select Version from Win32Reg_AddRemovePrograms where ProdID = '{EC542D5D-B608-4145-12F7-749C02B23494}'
Because Win32_Product is generally a class that should be avoided SCCM introduces it's own classes for this purpose:
Win32Reg_AddRemovePrograms
Win32Reg_AddRemovePrograms64
It should be possible to query one of those like this
select Version from Win32Reg_AddRemovePrograms where ProdID = '{EC542D5D-B608-4145-12F7-749C02B23494}'
answered Dec 18 '18 at 12:29
SyberdoorSyberdoor
1,6211613
1,6211613
Hi @Syberdoor, thank you for your suggestion. The queries you have suggested do not give all the products installed. So if I try "gwmi -class win32-addremovePrograms" or gwmi -class win32-addremovePrograms64 it is not listing all the installed products
– Abby Jangir
Dec 26 '18 at 5:02
actually they should not give all the programs installed, one should be a inventory of hklmsoftwaremicrosoftwindowscurrentversionuninstall hklmsoftwarewow6432nodemicrosoftwindowscurrentversionuninstall so they show the installed respective per machine 32bit and 64bit programs. Which one you need depends on whether you use 64bit or 32bit 7zip. I think there was also a bug years ago where the 64bit one did not work properly but it should be fixed afaik
– Syberdoor
Dec 26 '18 at 10:07
add a comment |
Hi @Syberdoor, thank you for your suggestion. The queries you have suggested do not give all the products installed. So if I try "gwmi -class win32-addremovePrograms" or gwmi -class win32-addremovePrograms64 it is not listing all the installed products
– Abby Jangir
Dec 26 '18 at 5:02
actually they should not give all the programs installed, one should be a inventory of hklmsoftwaremicrosoftwindowscurrentversionuninstall hklmsoftwarewow6432nodemicrosoftwindowscurrentversionuninstall so they show the installed respective per machine 32bit and 64bit programs. Which one you need depends on whether you use 64bit or 32bit 7zip. I think there was also a bug years ago where the 64bit one did not work properly but it should be fixed afaik
– Syberdoor
Dec 26 '18 at 10:07
Hi @Syberdoor, thank you for your suggestion. The queries you have suggested do not give all the products installed. So if I try "gwmi -class win32-addremovePrograms" or gwmi -class win32-addremovePrograms64 it is not listing all the installed products
– Abby Jangir
Dec 26 '18 at 5:02
Hi @Syberdoor, thank you for your suggestion. The queries you have suggested do not give all the products installed. So if I try "gwmi -class win32-addremovePrograms" or gwmi -class win32-addremovePrograms64 it is not listing all the installed products
– Abby Jangir
Dec 26 '18 at 5:02
actually they should not give all the programs installed, one should be a inventory of hklmsoftwaremicrosoftwindowscurrentversionuninstall hklmsoftwarewow6432nodemicrosoftwindowscurrentversionuninstall so they show the installed respective per machine 32bit and 64bit programs. Which one you need depends on whether you use 64bit or 32bit 7zip. I think there was also a bug years ago where the 64bit one did not work properly but it should be fixed afaik
– Syberdoor
Dec 26 '18 at 10:07
actually they should not give all the programs installed, one should be a inventory of hklmsoftwaremicrosoftwindowscurrentversionuninstall hklmsoftwarewow6432nodemicrosoftwindowscurrentversionuninstall so they show the installed respective per machine 32bit and 64bit programs. Which one you need depends on whether you use 64bit or 32bit 7zip. I think there was also a bug years ago where the 64bit one did not work properly but it should be fixed afaik
– Syberdoor
Dec 26 '18 at 10:07
add a comment |
SCUP uses the WSUS XML Schema specifically the BaseApplicabilityRules Schema. You can choose any of the Types documented on that page. They have different rules for different scenarios like WMI Query, file details, and registry queries among others. If you are looking for a version comparison from the registry the best choice would be RegSzToVersion
. Based on your question you would use something like
<bar:RegSzToVersion Key="HKEY_LOCAL_MACHINE" Subkey="SOFTWAREMicrosoftWindowsCurrentVersionUninstall{EC542D5D-B608-4145-12F7-749C02B23494}" Value="DisplayVersion" RegType32="false" Comparison="LessThan" Data="1.0.0.0" />
Comparison can be any of the following values
- LessThan
- LessThanOrEqualTo
- EqualTo
- GreaterThanOrEqualTo
- GreaterThan
RegType32 is, by default, false so you can leave it out if you choose. If the registry key is associated with a 32-bit entry, change that attribute to true or hardcode with the "WOW6432Node" path.
Data attribute is the target version number to compare against (in standard four part version number format).
add a comment |
SCUP uses the WSUS XML Schema specifically the BaseApplicabilityRules Schema. You can choose any of the Types documented on that page. They have different rules for different scenarios like WMI Query, file details, and registry queries among others. If you are looking for a version comparison from the registry the best choice would be RegSzToVersion
. Based on your question you would use something like
<bar:RegSzToVersion Key="HKEY_LOCAL_MACHINE" Subkey="SOFTWAREMicrosoftWindowsCurrentVersionUninstall{EC542D5D-B608-4145-12F7-749C02B23494}" Value="DisplayVersion" RegType32="false" Comparison="LessThan" Data="1.0.0.0" />
Comparison can be any of the following values
- LessThan
- LessThanOrEqualTo
- EqualTo
- GreaterThanOrEqualTo
- GreaterThan
RegType32 is, by default, false so you can leave it out if you choose. If the registry key is associated with a 32-bit entry, change that attribute to true or hardcode with the "WOW6432Node" path.
Data attribute is the target version number to compare against (in standard four part version number format).
add a comment |
SCUP uses the WSUS XML Schema specifically the BaseApplicabilityRules Schema. You can choose any of the Types documented on that page. They have different rules for different scenarios like WMI Query, file details, and registry queries among others. If you are looking for a version comparison from the registry the best choice would be RegSzToVersion
. Based on your question you would use something like
<bar:RegSzToVersion Key="HKEY_LOCAL_MACHINE" Subkey="SOFTWAREMicrosoftWindowsCurrentVersionUninstall{EC542D5D-B608-4145-12F7-749C02B23494}" Value="DisplayVersion" RegType32="false" Comparison="LessThan" Data="1.0.0.0" />
Comparison can be any of the following values
- LessThan
- LessThanOrEqualTo
- EqualTo
- GreaterThanOrEqualTo
- GreaterThan
RegType32 is, by default, false so you can leave it out if you choose. If the registry key is associated with a 32-bit entry, change that attribute to true or hardcode with the "WOW6432Node" path.
Data attribute is the target version number to compare against (in standard four part version number format).
SCUP uses the WSUS XML Schema specifically the BaseApplicabilityRules Schema. You can choose any of the Types documented on that page. They have different rules for different scenarios like WMI Query, file details, and registry queries among others. If you are looking for a version comparison from the registry the best choice would be RegSzToVersion
. Based on your question you would use something like
<bar:RegSzToVersion Key="HKEY_LOCAL_MACHINE" Subkey="SOFTWAREMicrosoftWindowsCurrentVersionUninstall{EC542D5D-B608-4145-12F7-749C02B23494}" Value="DisplayVersion" RegType32="false" Comparison="LessThan" Data="1.0.0.0" />
Comparison can be any of the following values
- LessThan
- LessThanOrEqualTo
- EqualTo
- GreaterThanOrEqualTo
- GreaterThan
RegType32 is, by default, false so you can leave it out if you choose. If the registry key is associated with a 32-bit entry, change that attribute to true or hardcode with the "WOW6432Node" path.
Data attribute is the target version number to compare against (in standard four part version number format).
edited Dec 28 '18 at 18:36
answered Dec 28 '18 at 5:59
Paul GPaul G
36926
36926
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53830437%2fhklm-registry-key-values-access-using-wql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown