Help with SCCM query for lower versions
Hi!
I need some help with a SCCM query for a Lync update. I usually ask for all computers with Software X that isn't version Y etc. This has worked well, but the problem now is that i need to update Lync on computers that has a version number lower than the one I'm deploying. WSUS will handle updates after this, so i can't ask for an exact version non-match, because then it will try to downgrade newer versions when they come.
Since the version number is a string i won't be able to just add a > operator in the query. I guess the version number needs to split up and sorted somehow (regex?).
Computers with these versions should be added to the collection:
4.0.7577.0
4.0.7577.280
4.0.7577.314
4.0.7577.4087
Any version number higher than 4087 can't be added to the collection.
I hope someone can help me! Thanks in advance!
This is a working query with version non-match (not what i want):
select
SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client
from
SMS_R_System
where (SMS_R_System.ResourceId in
(select SMS_R_System.ResourceId from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId
where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
like "Microsoft Lync 2010" and SMS_G_System_ADD_REMOVE_PROGRAMS.Version != "4.0.7577.4103")
or SMS_R_System.ResourceId in
(select SMS_R_System.ResourceId from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS_64 on SMS_G_System_ADD_REMOVE_PROGRAMS_64.ResourceID = SMS_R_System.ResourceId
where SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName like "Microsoft Lync 2010" and SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version != "4.0.7577.4103"))
and SMS_R_System.OperatingSystemNameandVersion like "%workstation%"
and (SMS_R_System.SystemOUName like "FOO.int/Foo" or SMS_R_System.SystemOUName like "FOO.int/BAR")
and SMS_R_System.Client = 1
Answers (1)
Use the below in place of SMS_G_System_ADD_REMOVE_PROGRAMS.Version != "4.0.7577.4103" SMS_G_System_ADD_REMOVE_PROGRAMS.Version = "4.0.7577.0" or SMS_G_System_ADD_REMOVE_PROGRAMS.Version = "4.0.7577.280" or SMS_G_System_ADD_REMOVE_PROGRAMS.Version = "4.0.7577.314" or SMS_G_System_ADD_REMOVE_PROGRAMS.Version = "4.0.7577.4087" below part in place of SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version != "4.0.7577.4103" SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version = "4.0.7577.0" or SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version = "4.0.7577.280" or SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version = "4.0.7577.314" or SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version = "4.0.7577.4087"
Why can't you include the below part in place of SMS_G_System_ADD_REMOVE_PROGRAMS.Version != "4.0.7577.4103"
SMS_G_System_ADD_REMOVE_PROGRAMS.Version = "4.0.7577.0" or SMS_G_System_ADD_REMOVE_PROGRAMS.Version = "4.0.7577.280" or SMS_G_System_ADD_REMOVE_PROGRAMS.Version = "4.0.7577.314" or SMS_G_System_ADD_REMOVE_PROGRAMS.Version = "4.0.7577.4087"
below part in place of SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version != "4.0.7577.4103"
SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version = "4.0.7577.0" or SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version = "4.0.7577.280" or SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version = "4.0.7577.314" or SMS_G_System_ADD_REMOVE_PROGRAMS_64.Version = "4.0.7577.4087"
Comments:
-
Doh, didn't think about that. Thanks! That should work in this case. I just pulled the version numbers while writing the question without thinking about it ;)
I'm still on the lookout for something more dynamic for future use though. - Ifan 12 years ago -
Used an "in" instead. Made the query a bit shorter ;) - Ifan 12 years ago