0 votes

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 (730 points)

1 Answer

0 votes
by (215k 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.

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

Hello, I'd like to create a custom Adaxes report based on the following Logging Filters - I'm currently having to filter the logs manually each time I want to gather this ... would be easier to jump on a call to discuss this further? Thank you in advance!

asked Nov 16, 2020 by sirslimjim (400 points)
0 votes
1 answer

Testing script located here https://www.adaxes.com/script-repository/export-data-from-onedrive-s568.htm $tenantDN not Null Throwing Error: You cannot ... CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull

asked Sep 1, 2020 by Derek.Axe (440 points)
0 votes
1 answer

Hi All, I see that Adaxes uses a local SQLite database for logging. However when a user enrols for password resets using a question and answer based authentication, where is ... some more sensitive than others so I was just wondering how it is handled? Thanks,

asked Apr 15, 2020 by antondubek (440 points)
0 votes
1 answer

I would like to be able to build a workflow whereby, after creating a user, a business rule will check certain user attributes/group memberships etc and then, if required, ... ways that this could be achieved to make a 'joined up' process? Thanks, Bernie

asked Aug 24, 2019 by Bernie (310 points)
2,761 questions
2,495 answers
6,538 comments
1,483,228 users