0 votes

I would like to query the "Account Expires" field and output it as the default entry in description but I prefer the format Jun 7 2013 and not 06/07/13.

There are just too many ways to understand 06/07/13 with staff from every imaginable country.

Any ideas?

by (280 points)

1 Answer

0 votes
by (216k points)

Hello,

This can be easily done with PowerShell scripts. You can create a PowerShell script that updates a user's description with the expiration date of the user's account and add the script to a Custom Command, Scheduled Task or Business Rule with the help of the Run a program or PowerShell script action.

For example, if you want to set the value of the Account Expires property as the default description for all newly created users:

  1. Create a new Business Rule.

  2. On the 2nd step of the Create Business Rule action, select User and After Creating a User.

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

     $dateConversionFormat = "MMM d yyyy" # TODO: Modify me
    
     $accountExpires = $Context.TargetObject.Get("accountExpires")
     if ($accountExpires -eq 9223372036854775807)
     {
         $Context.TargetObject.Put("Description", "Account never expires")
     }
     else
     {
         $expirationDate = $Context.TargetObject.AccountExpirationDate.ToString($dateConversionFormat)
         $Context.TargetObject.Put("Description", "Account expires on $expirationDate")
     }
    
     $Context.TargetObject.SetInfo()
    
  4. In the script, $dateConversionFormat specifies how the date should be converted into a string. For information on how you can specify different date conversion formats, see the Custom Date and Time Format Strings article by Microsoft.

  5. When done with the script, finish creation of the Business Rule.

Related questions

0 votes
1 answer

As you can see in the picture, we currently have three different formats as soon as we look at a user's data. Can this be adjusted so that only one format dd.mm.yyyy is displayed? Thank you very much

asked Nov 17, 2023 by DRiVSSi (320 points)
0 votes
1 answer

I realise that this has been asked a few times but I can't seem to get to resolution having read through previous advice. We have scheduled tasks set up to automatically ... /time region settings on all servers currently using Adaxes. They're all set to UK.

asked Apr 21, 2023 by Homelander90 (350 points)
0 votes
1 answer

Hi, Following an update from Adaxes 2016 to 2021.1 we noticed that the date format on the email notifications is no longer English UK, but English US, i.e. ... every scheduled task/business rule that sends a notification and changing the variable? Thanks, Gary

asked Sep 27, 2022 by gazoco (490 points)
0 votes
1 answer

Is it possible to change the date format to UK style when using attributes in email messages? For example I am using %adm-CustomAttributeDate1% as a placeholder for a users start ... time being left it there if there isn't a way around it. Kind Regards Danny

asked Jun 1, 2015 by dannyd (200 points)
0 votes
1 answer

At user creation, when the inbox is created, I'd like to be able to format the address as firstname.lastname@domain.com for some users. Other users firstnameintial.lastname@domain.com, is this possible? Envornment is hybrid O365. Thanks!

asked Jan 4 by cewilson (190 points)
3,588 questions
3,277 answers
8,303 comments
548,085 users