0 votes

Hello,

I'd like the change the behavior of the account expires field from end of the day meaning 12am the next day to a specific time on the date specified.

Example 5pm on August 2nd instead of 12am on August 3rd.

The business rule I started out errors out for looping through. How would I change this and not create a loop?

I got the idea from here: https://mikefrobbins.com/2013/12/12/set ... owershell/

by (1.2k points)

1 Answer

0 votes
by (272k points)
selected by
Best answer

Hello,

The loop appears because the value set by the Modify the user action meets the conditions specified for the Business Rule. To avoid this and still set the Account Expires property as desired, you can use the Run a program or PowerShell script action with the below script instead of the Modify the user action. The script will update the Account Expires property directly in Active Directory, thus the Business Rule will not trigger again and there will be no corresponding record in Adaxes logs.

$valueToSet = "%accountExpires,,17:00%" # TODO: modify me

# Update the user
$Context.TargetObject.Put("accountExpires", $valueToSet)
$Context.TargetObject.SetInfo()
0

Brilliant, thank you!

Related questions

0 votes
1 answer

We currently have a form for HR to deal with ex-employees that are hired once more, but it's not much more than automatic emails sent to IT. If I add some actions ... this trigger the business rule we have that targets "After updating a user" ? Thanks, Louis

asked Oct 18, 2022 by lw.fa (130 points)
0 votes
1 answer

I am trying to trigger processing outside of Active Directory when an account is created based on the source user account that was used. Does Adaxes store the source account anywhere?

asked Oct 9, 2023 by jnordell (20 points)
0 votes
1 answer

Is there a way to set a users' UPN Suffix within a business rule (PS script)? I've seen the script to update the suffix based on OU, but our OU structure ... primary email address, or to apply a particular UPN suffix based on department. Either method works.

asked Apr 3, 2017 by steve.newton (50 points)
0 votes
1 answer

I'm not entirely sure if this is possible using a business rule but what I am trying to achieve is have the business rule perform actions when a user account has expired. Can this be acheived or would a scheduled task be the preferred method?

asked Sep 21, 2020 by Richard_NRL (90 points)
0 votes
1 answer

We would like to create a ticket in our ticketing system after a user's account is unlocked. I would like to use a business rule to do this so that it happens automatically. I don't see an option for this. I only see "After updating a user:"

asked Feb 4, 2020 by mark.it.admin (2.3k points)
3,346 questions
3,047 answers
7,782 comments
544,984 users