+1 vote

Hi all,

I already used the import data wizard to create new user but I recently tried to create new user with an account expiration date in the csV.
It seems that when I use the wizard, the AccountExpirationDate column is not recognized as an AD field (a warning is displayed when I tick it).
I also tried with AccountExpires column name and Adaxes match correctly with the AD filed but it seems it expects the Large Int value instead of a Date.

Is there a way to import this value through de wizard. For information, I prefere to use the wizard in order to delegate more easiliy some tasks to other admins.

Have a nice day

Enjoy your Summer :lol:

Regards

by (740 points)

1 Answer

0 votes
by (216k points)

Hello,

In one of the future releases, we'll make it possible to specify a text representation of a date when an account must expire. For now, you can workaround this by using a certain virtual attribute for specifying the expiration date in the text format. Adaxes provides a set of virtual attributes that are not stored in AD, but can be used the same as any other attribute of AD objects. You can specify the account expiration date in your CSV files using one of such attributes that allows passing text data, for example, CustomAttributeText1. Also, you can create a Business Rule triggered by creating a new account in AD that will set the expiration date of the account being created to the date specified in the virtual attribute.

If you implement a Business Rule as described below, you will be able to use any valid text that represents a date to specify account expiration date in the CSV file, for example 7/18/2015, 10.01.2016 or February 15, 2015.

To do this:

  1. In the CSV file that you want to import, set the header of the column that contains account expiration dates to the LDAP name of the virtual property that you chose. For example, if you chose CustomAttributeText1, the column header must be adm-CustomAttributeText1.

  2. Create a Business Rule that sets the account expiration date based on the value of the virtual attribute. To do this:

    • Create a new Business Rule.

    • On the 2nd step of the Create Business Rule wizard, select User and Before Creating a User.

    • On the 3rd step, add the Run a Program or PowerShell script action and paste the following script in the Script field:

        ```powershell
        # Get account expiration date from the virtual property
        $accountExpiresText = $Context.GetModifiedPropertyValue("adm-CustomAttributeText1")
      
        # Clear the virtual property
        $Context.SetModifiedPropertyValue("adm-CustomAttributeText1", $NULL)
      
        # Convert the text representation of the date into the DateTime format
        try
        {
            $accountExpires = [System.DateTime]::Parse($accountExpiresText)
        }
        catch
        {
            $Context.LogMessage("Failed to set an expiration date for the user. " + $_.Exception.Message, "Warning") # TODO: modify me
            return
        }
        $Context.SetModifiedPropertyValue("accountExpires", $accountExpires)
      
        ```
    • Enter a short description for the script and click OK.

    • Now, you need to add a condition for the Business Rule to be triggered only when an expiration date is specified in the virtual attribute. For this purpose, double-click Always.

    • Select the If <property> <relation> <value> condition.

    • Expand the <property> drop-down list and select Show all properties.

    • Select the virtual property that you chose for passing the expiration date, for example, CustomAttributeText1.

    • Select is not empty.

    • Click OK.

    • Finish creation of the Business Rule.

  3. Import the CSV file using the Import Data Wizard.

0

Thanks for your answer.
I thought about this workaround :lol: and if there's no other way i'll do like that.

Thanks again

Kind regards

0

Well, this is, probably, the easiest way :)

Another option is to import CSV files using PowerShell. For details, see section Import CSV File Using PowerShell in the following tutorial: http://www.adaxes.com/tutorials_ActiveD ... SVFile.htm. If you want to import using PowerShell, the column header for the account expiration date must be AccountExpirationDate. Values in the AccountExpirationDate column can contain a text representation of the expiration date.

0

Hi support,

Appreciate this is an old thread so apologies.

I am trying to do something similiar however in our csv file the column is called 'Termination Date' and we cannot change that.

Based on this would you suggest we map this column to Customattributetext1 and then have a business rule 'Before updating a user' on this atrtibute which runs a powershell task as you have highlighted to add the ldap value to the accountExpires attribute?

Account Expiry update via csv import

Related questions

0 votes
1 answer

As a Google Apps user we occasionally need to set Out of Office replies for a user or add a delegate. We are hoping to enable managers to do this on their own via the Adaxes ... up with a way to select the 2 users and then run a custom command. Thanks! Jake

asked Oct 8, 2015 by jakesomething (190 points)
0 votes
1 answer

In this case the working example would be that the user would need to add a new title into a list of titles in the title property pattern

asked Dec 13 by msheppard (660 points)
0 votes
1 answer

For context, up until now, we had a business rule in place stopping accounts from being created for users with the same name e.g. Jacob Smith and Jacob Smith. This business ... , or how to, if possible, remove this. Any help would be most appreciated! Thanks

asked Oct 22 by Charlie.Evans (70 points)
0 votes
1 answer

Hello. I got a script that when E-mail forwarding is set, it automatically sends an email to the person that will recieve the forwarded emails for 6 months. But I'd like ... what to put in the xxxxxxx so it would take the account that im running command on.

asked Jun 3 by EdgarsABG (110 points)
0 votes
1 answer

Hello there, We have recently moved (almost) every computer from on-prem to cloud only and have setup some scheduled tasks to disable users based off of Last Logon and Last Logon ... in a different way? And if not, are there any plans to leverage that data?

asked May 21 by jacobchugg (20 points)
3,589 questions
3,278 answers
8,303 comments
548,107 users