Automatic Group using Current Date

(imported topic written by jdonlin)

All,

I’ve created an automatic group to generate a list of all machines with an OS Install Date of ‘current date’.

As I thought might happen, the criteria is treating the Inspector ‘current date’ as a text field (as string as lowercase = “current date”).

Other than entering in the current date into the group, is there a way to code ‘current date’ so it translates the date?

Thanks.

Jim

(imported comment written by jessewk)

Hi Jim,

I’m not quite sure I understand your question correctly, but I believe you are asking for relevance that compares the 'InstallDate" value under the key “HKEY_LOCAL_MACHINE\software\microsoft\Windows NT\current version” to the current date. Is that correct?

If so, here is a QnA session that shows how I created such a query. The key is that you need to convert ‘InstallDate’ which is an object of type ‘registry key value’ to an object of type ‘date’. It takes a few steps to do that: --> --> --> -->

Q: current date
A: Tue, 26 Jun 2007
I: singular date

Q: value “InstallDate” of key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion” of registry
A: 1158342328
I: singular registry key value

Q: value “InstallDate” of key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion” of registry as integer
A: 1158342328
I: singular integer

Q: value “InstallDate” of key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion” of registry as integer * second
A: 13406 days, 17:45:28
I: singular time interval

Q: “01 Jan 1970 00:00:00 +0000” as time + (value “InstallDate” of key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion” of registry as integer) * second
A: Fri, 15 Sep 2006 10:45:28 -0700
I: singular time

Q: date (local time zone) of (“01 Jan 1970 00:00:00 +0000” as time + value “InstallDate” of key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion” of registry as integer * second)
A: Fri, 15 Sep 2006
I: singular date

Q: current date = date (local time zone) of (“01 Jan 1970 00:00:00 +0000” as time + (value “InstallDate” of key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion” of registry as integer) * second)
A: False
I: singular boolean

-Jesse

(imported comment written by jdonlin)

Hi Jesse,

Thanks for the reply.

When I created the automatic group, I wanted to be able to translate “current date” within the relevance instead of manually adding the date. I’m not explaining it right so I’ll attach a pic. I initally typed in ‘current date’ wher ethe actual date is but got no results.

I’ve also changed my criteria as a machine with a build date of today may still be in the build process.

May be a custom report or an analysis is in order.

Thanks.

Jim

(imported comment written by jessewk)

Hi Jim,

In the ‘Edit Automatic Computer Group’ dialog, instead of using the OS install date property, you can scroll all the way to the top of the properties list and choose ‘Relevance Expression’. If you put the relevance I posted into the ‘Edit Relevance’ dialog that becomes accessible after selecting ‘Relevance Expression’ and choose the ‘is true’ comparison operator, you’ll get the behavior you’re looking for.

If you’d like to have yesterday, you can modify the relevance above like so: ‘current date - 1*day = date (local time zone) …’

-Jesse

(imported comment written by jdonlin)

Jesse,

I have a big smile on my face. I did not realize the “Relevance Expression” existed. I ran your suggestion thru QNA and it worked. I’ve just edited the Automatic Computer group.

THANK YOU for your help!

Jim

One more question: In what class would this have been revealed? I may attend a class.

(imported comment written by jessewk)

Hi Jim,

You’re welcome. I’m glad it worked.

I’m just guessing, but I think automatic groups are covered in basic form in the Console operator course and the relevance portion would be covered in the Custom Content course.

Here’s the

training page.

-Jesse

(imported comment written by jdonlin)

This automatic group works with the relevance. The only thing I find with this group is machines that do not check in again stay on the list.

There is no way to right-click and “remove from group.” At this point, I’ll delete it and recreate it. (group has 196 machines with 85 being built yesterday)

Any ideas?

Thanks!

Jim

(imported comment written by jessewk)

Hi Jim,

Automatic group membership is determined on the client, not by the server. So you are correct that machines wont drop out of the automatic group from the console perspective until the client is able to report, and there is no way to manually remove certain clients from an automatic group.

However, if you take an action targeted at the automatic group, only clients that still evaluate the membership relevance to true at the time the action is about to run will run the action.

-Jesse

(imported comment written by jdonlin)

Thanks Jesse!

Jim