Hello Ingemar,
This happens because of how the When Marked Inactive attribute behaves. The thing is that it is a special attribute introduced for a very specific reason: marking inactive disabled accounts. The property will not be set if an account is enabled. Thus, if the accounts in question are enabled, the When Marked Inactive attribute is not set by your Scheduled Task, and the accounts always meet its conditions.
To workaround the issue, you can use either of the following 2 workarounds:
- Disable accounts. You can add an action that disables the accounts to your Scheduled Task just before setting the When Marked Inactive attribute.
- Alternatively, if you don't want to disable the accounts, you can use another attribute to store the date when an account was marked inactive. For example, you can use one of Adaxes virtual properties that can store date/time values, for example, CustomAttributeDate1. Such properties are not stored in AD, but can be used the same as any other attribute of AD objects.