Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Collection Creation

Status
Not open for further replies.

kevinnaomi

IS-IT--Management
Sep 26, 2002
81
US
I am trying to create a colletion that will update once a month.
The member of this collection will be pcs that haven`t run metered application "XX" for at least 90 days.
I am able to do this if I statically put the date in the criteria of the collection, but was wondering if there was a way to have the 90 day rule in the criteria.
I am having no luck finding an answer, and was hoping that maybe someone had done this before...
 
When looking at your query inside the collection, click "Show Query Language". Your criteria date, change to something like this:

and datediff(day,SMS_G_SYSTEM_WORKSTATION_STATUS.LastHardwareScan,getdate()) < "30"

This example is for the Last Hardware Inventory scan date, but you should be able to use it in your query as a guide. Note once you do this, you won't be able to go back to "Show Query Design"; but it works anyway.
 
Can you post an example from one of your collections? I have tried adding that line and each time it doesn't like the query statement. It lets me click OK once "while leaving it on Show Query Design" but it doesn't allow me to go further. Thanks.
 
Here's one "All XP workstations, HW INV last 30 days"

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 inner join SMS_G_System_WORKSTATION_STATUS on SMS_G_System_WORKSTATION_STATUS.ResourceID = SMS_R_System.ResourceId where OperatingSystemNameandVersion = "Microsoft Windows NT Workstation 5.1" and datediff(day,SMS_G_System_WORKSTATION_STATUS.LastHardwareScan,getdate()) <= "30"

Blog:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top