none
Limit Collection Count

    Question

  • We are deploying a software install script out to a large number of clients and have written a query to find everything without our most up to date software version. However, we don't want to advertise our entire client pool at once. We've gone through our limited dev and test groups and now just need to deploy it to a large general pool (every one else).

    Is there a way to limit the number of returned results so that we just get the first n number of query results in the collection? I've found a way to do this globally, but not a collection/query specific method. 

    We plan on making this dynamic and scheduling it so that every day the collection re-queries and finds an additional n machines and advertises the package to them.

    Current query defining the collection =  

    SELECT 
    SMS_R_System.Name 
    FROM SMS_R_System 
    WHERE ResourceID NOT IN ( 
    SELECT ResourceID FROM 
    SMS_G_System_ADD_REMOVE_PROGRAMS smsgsarp 
    WHERE 
    smsgsarp.DisplayName = "software") 
    AND 
    ResourceID NOT IN ( 
    SELECT ResourceID FROM 
    SMS_G_System_ADD_REMOVE_PROGRAMS_64 smsgsarp64 WHERE 
    smsgsarp64.DisplayName = "software")

    Thursday, February 23, 2012 9:59 PM

Answers

  • Oops.

    You are using WQL, WQL does not support the TOP command.

    There are some possible solutions here:

    http://social.technet.microsoft.com/Forums/en-US/configmgrswdist/thread/1e2d883f-6330-4336-84cf-ff287036b324


    LinkedIn


    • Edited by Adrian Roesch Thursday, February 23, 2012 10:48 PM
    • Marked as answer by Sabrina Shen Monday, March 05, 2012 6:22 AM
    Thursday, February 23, 2012 10:29 PM
  • We accomplish staggered rollouts by limiting the rollout collection by last digit of IP address.

    I start with a master collection: "Application XYZ Deployment".  Then, I create a sub-collection called "Application XYZ Deployment ramp-up".  My advertisement targets this sub-collection.  The membership of the sub-collection is limited to the master collection, and the query looks something like this:

    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.IPAddresses like "%1" or SMS_R_System.IPAddresses like "%2" or SMS_R_System.IPAddresses like "%3"

    Nick.

    • Marked as answer by Sabrina Shen Monday, March 05, 2012 6:21 AM
    Friday, February 24, 2012 5:48 PM
  • Hi,

    You can create a new collection which is limited to the collection create based on your posted query.

    Keep this collection empty and create subcollections like this:

    Select * from SMS_R_System where SMS_R_System.ResourceID = "%0"

    Select * from SMS_R_System where SMS_R_System.ResourceID = "%1"

    ...

    Select * from SMS_R_System where SMS_R_System.ResourceID = "%9"

    You can added these subcollections one by one, then your deployment target clients will increasing by 10%.

    Hope this will help.

    Thanks

    • Marked as answer by Sabrina Shen Monday, March 05, 2012 6:21 AM
    Tuesday, February 28, 2012 7:20 PM

All replies

  • .

    Cheers.


    LinkedIn




    • Marked as answer by Tom_UofA Thursday, February 23, 2012 10:04 PM
    • Unmarked as answer by Tom_UofA Thursday, February 23, 2012 10:05 PM
    • Edited by Adrian Roesch Thursday, February 23, 2012 10:49 PM Dud answer,
    Thursday, February 23, 2012 10:03 PM
  • Thanks Adrian, but when I go to save the query language I'm prompted "This query has a syntax error. Are you sure you want to save it?" I went a head and saved and it does in fact break the query, returning no results. 
    Thursday, February 23, 2012 10:14 PM
  • Oops.

    You are using WQL, WQL does not support the TOP command.

    There are some possible solutions here:

    http://social.technet.microsoft.com/Forums/en-US/configmgrswdist/thread/1e2d883f-6330-4336-84cf-ff287036b324


    LinkedIn


    • Edited by Adrian Roesch Thursday, February 23, 2012 10:48 PM
    • Marked as answer by Sabrina Shen Monday, March 05, 2012 6:22 AM
    Thursday, February 23, 2012 10:29 PM
  • For stagged deployments I've added queries for machine names ending with 0/1, 2/3. 3/4 etc. C0uld have a look at http://ccmexec.com/2010/11/planning-an-upgrade-of-an-application/ by Jörgen

    • Edited by -Johno- Friday, February 24, 2012 1:46 AM
    Friday, February 24, 2012 1:45 AM
  • We accomplish staggered rollouts by limiting the rollout collection by last digit of IP address.

    I start with a master collection: "Application XYZ Deployment".  Then, I create a sub-collection called "Application XYZ Deployment ramp-up".  My advertisement targets this sub-collection.  The membership of the sub-collection is limited to the master collection, and the query looks something like this:

    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.IPAddresses like "%1" or SMS_R_System.IPAddresses like "%2" or SMS_R_System.IPAddresses like "%3"

    Nick.

    • Marked as answer by Sabrina Shen Monday, March 05, 2012 6:21 AM
    Friday, February 24, 2012 5:48 PM
  • Hi,

    You can create a new collection which is limited to the collection create based on your posted query.

    Keep this collection empty and create subcollections like this:

    Select * from SMS_R_System where SMS_R_System.ResourceID = "%0"

    Select * from SMS_R_System where SMS_R_System.ResourceID = "%1"

    ...

    Select * from SMS_R_System where SMS_R_System.ResourceID = "%9"

    You can added these subcollections one by one, then your deployment target clients will increasing by 10%.

    Hope this will help.

    Thanks

    • Marked as answer by Sabrina Shen Monday, March 05, 2012 6:21 AM
    Tuesday, February 28, 2012 7:20 PM