AccountExpires Approval Notification with a real date

In the approval notification for when a users account expiration is changed, the client is wanting to show a date when the account will expire, or the number of days until the account expires.  The problem is that if we add the AccountExpires attribute to the email message, the INT8 date/time is shown.  We were able to get a Policy script to work to set a VA with a readable date, however, that only fires when the attribute gets changed, therefore it is not available for when the Approval notification is sent out.  It did work once, but ALL subsequent execution did not occur.  We add the calling of the script to the Workflow before the Approval, and it worked only once as well.  We have attempted to use C# within the asp.net code of the notification, but this would not convert the Account Expires to a readable format either.

So, the question is, how do you get the Approval Notification to show the Account Expires in a readable format?

Parents
  • Hello Rodney,

    As of right now, Active Roles requests the use of a script in order to convert from the Active Directory FileTime time format.

    The actual script itself is extremely simple. You could use something like this in a Change Workflow:

    function returnReadableAccountExpiresDate($Request)
    {
        return [datetime]::fromfiletime($DirObj.accountExpires)
    }

    This could be used to populate a value to a stored custom Virtual Attribute in either an "Update" or "Modify requested changes" Workflow activity. This custom Virtual Attribute can then be embedded into your notification as a custom token.

    Please let me know if you have any questions or concerns.

    Regards,
    Terrance Crombie

  • Did you get this working with the accountExpires Attribute? Some time ago i tried to achieve the same thing and used 

    $Intgerdate = (Get-QADUser $DN -Properties "msDS-UserPasswordExpiryTimeComputed")."msDS-UserPasswordExpiryTimeComputed"
    $convertedDate = [datetime]::fromfiletime($Intgerdate)

    accountExpires converts the date to some weird date

    EBUG: ! CALL function '<ScriptBlock>'
    DEBUG: 11+ >>>> {

    DEBUG: ! CALL function 'onPreModify'
    DEBUG: 12+ if( >>>> $Request.class -ne "user"){return}

    DEBUG: 16+ >>>> [string]$accountExpiresReadable = [datetime]::fromfiletime($Request.Get("accountExpires"))

    Call method '$Request.Get'
    Arguments list:
    [1] : Value=accountExpires : Type=System.String

    DEBUG: ! SET $accountExpiresReadable = '01/01/1601 01:00:00'.
    DEBUG: 17+ >>>> $DirObj.Put("edsvaUserPasswordExperation", $accountExpiresReadable)

    DEBUG: 18+ >>>> $DirObj.SetInfo()

    Call '$DirObj.SetInfo'
    ERROR:
    At line: 18 char:9. Exception calling "SetInfo" with "0" argument(s): "Administrative Policy returned an error.
    Recursion is too deep; nested policy execution limit has been exceeded.

Reply
  • Did you get this working with the accountExpires Attribute? Some time ago i tried to achieve the same thing and used 

    $Intgerdate = (Get-QADUser $DN -Properties "msDS-UserPasswordExpiryTimeComputed")."msDS-UserPasswordExpiryTimeComputed"
    $convertedDate = [datetime]::fromfiletime($Intgerdate)

    accountExpires converts the date to some weird date

    EBUG: ! CALL function '<ScriptBlock>'
    DEBUG: 11+ >>>> {

    DEBUG: ! CALL function 'onPreModify'
    DEBUG: 12+ if( >>>> $Request.class -ne "user"){return}

    DEBUG: 16+ >>>> [string]$accountExpiresReadable = [datetime]::fromfiletime($Request.Get("accountExpires"))

    Call method '$Request.Get'
    Arguments list:
    [1] : Value=accountExpires : Type=System.String

    DEBUG: ! SET $accountExpiresReadable = '01/01/1601 01:00:00'.
    DEBUG: 17+ >>>> $DirObj.Put("edsvaUserPasswordExperation", $accountExpiresReadable)

    DEBUG: 18+ >>>> $DirObj.SetInfo()

    Call '$DirObj.SetInfo'
    ERROR:
    At line: 18 char:9. Exception calling "SetInfo" with "0" argument(s): "Administrative Policy returned an error.
    Recursion is too deep; nested policy execution limit has been exceeded.

Children