Applies To:

GroupID 10 - Automate

Business Scenario:

How can I create a Smart Group of the users who have joined the organization recently and their user accounts in AD have been created in the last 30 days prior to the current date.


We can use the AD attribute, whenCreated, which keeps track of the date an AD account was created on. We can compare the value stored in this attribute with the current date using a VB script in the Query Designer of the New Smart Group wizard (Automate module).

  1. In GroupID Management Console, select Automate > right-click All Groups > New > Smart Group
    The New Smart Group wizard opens to the Welcome page.
  2. Complete the initial steps of providing a suitable name for this group, its OU, security type, group type and whether you want to mail-enable it. Click Next.
  3. In the next step, you will be asked about the LDAP query of this Smart Group. Click the Modify button; the Query Designer window is displayed.
  4. Select an object type. Since we are dealing with the User objects here, select User. Next, navigate to the Identity Store tab in the Query Designer and enter the following criteria:

  5. Next, we need a VB script to do a comparison with the current date. Navigate to the Smart Script tab in the Query Designer and click the Edit Script button. The Script window of the Query Designer is displayed.

  6. Add the following script in the Sub ATM_BuildQuery(ByVal atmsource As Object, ByVal args As QueryEventArgs) function:
    Dim CreateDate as string
    CreateDate = DateAdd(DateInterval.DayOfYear,-30,DateTime.Now)
    args.criteria = string.Format(args.criteria, CreateDate)

  7. Once done, click Build at the top and select Compile Script. It should show a success message.

  8. After this, close the Scripting window. You will be asked to save the changes. Please save them and exit.
  9. Now click the Preview button and it should only pick up the user accounts that were created in the last 30 days. Complete the New Smart Group wizard and the group should be populated with those members.


GroupID Automate user guide