Collection based on NOT having file, with version (Full Version)

All Forums >> [Management Products] >> Microsoft Systems Management Server >> SMS 2003



Message


joemonkey -> Collection based on NOT having file, with version (9/25/2008 10:22:10 AM)

I've been banging my head over this and every time I think I have it I get the message that I have entered an incorrect query..  I know I need a subselect query, but I simply cannot get it to work properly.  I want to create a collection that contains computers that have a specific file where the file version is less than version 8%.  Is this even possible?




skissinger -> RE: Collection based on NOT having file, with version (9/25/2008 11:05:39 AM)

When I'm trying to figure out a complex collection query, I start small.  In the queries section of the console, I'd start by first getting all the computers with the file at all, and display the version, & the path.  Then I'd start tweaking it to be 'less than 8'.  Depending upon the # of versions you might have listed, you might want to use the "version is in" and a static list of the version numbers, instead of the less than.

Depending upon the file, it may appear in multiple locations on the client as well.  You might also need to limit it to "and file path is like".




nivor -> RE: Collection based on NOT having file, with version (9/25/2008 12:04:37 PM)

This should work, obviously add the file name and version number:

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 ResourceId not in (select distinct SMS_G_System_SoftwareFile.ResourceID from  SMS_G_System_SoftwareFile where SMS_G_System_SoftwareFile.FileName = "FileNameHere" and SMS_G_System_SoftwareFile.FileVersion < "VersionNumberHere")




jnelson993 -> RE: Collection based on NOT having file, with version (9/25/2008 12:30:07 PM)

Actually, that won't work as expected. SQL and WQL are going to use a letter-by-letter dictionary sort so version 8 is going to be GREATER than version 11 because the character 8 comes AFTER character 1 in the dictionary.  You'll likely have to use a LIKE statement and the bracket wildcard [] operator to catch all the versions from 0-7.  And you don't need a subselect, because you're looking for computers that HAVE the file where it's less than version 8.%.  So, something like this perhaps:

SELECT
  sys.ResourceID,
  sys.ResourceType,
  sys.Name,
  sys.SMSUniqueIdentifier,
  sys.ResourceDomainORWorkgroup,
  sys.Client
FROM  
  SMS_R_System AS sys
  INNER JOIN SMS_G_System_SoftwareFile AS sf
     ON sys.resourceID = sf.resourceID
WHERE
  sf.FileName = "FileNameHere"
  AND sf.FileVersion LIKE "[0-7].%"


So, if the FileVersion starts with "0." through "7." , it will show up in the report...Make sense?
For completeness, let's quickly talk about wildcards...a wildcard character you're probably all familiar with is the % sign.  It basically means match 0 or more of any characters.  Then there's the underscore _ which means match any single character.  But there's also these brackets [ ] which let you specify a range (where [0-9] means a single character matching the number 0 through 9 or [a-g] means a single character matching any letter from a through g) or a set (where [135] means a single character matching a 1, 3 or 5 and [adf] means any single character matching a, d or f).  You can also put those brackets next to each other to specify multiple ranges (like [0-9][0-9] representing every number between 00 and 99].




joemonkey -> RE: Collection based on NOT having file, with version (9/25/2008 1:39:04 PM)

thanks jnelson993, I didn't realize the sort would work like that, or that the bracket variable even existed.  Seems to be working fine now




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.25