Skip to content

Tools4everBV/HelloID-Task-SA-Target-ActiveDirectory-AccountUpdateExpireDate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HelloID-Task-SA-Target-ActiveDirectory-AccountUpdateExpireDate

Prerequisites

  • The HelloID SA on-premises agent installed

  • The ActiveDirectory module is installed on the server where the HelloID SA on-premises agent is running.

Description

This code snippet executes the following tasks:

  1. Define a hash table $formObject that holds the values entered in the form.

To view an example of the form output, please refer to the JSON code pasted below.

{
    "UserPrincipalName": "",
    "ExpirationDate": "01/01/2023"
}

❗ It is important to note that the names of your form fields might differ. Ensure that the $formObject hashtable is appropriately adjusted to match your form fields.

  1. Imports the ActiveDirectory module.

  2. Retrieve the user account object using the Get-ADUser cmdlet.

  3. Update the account using the $user object retrieved from step 3 and update the ExpirationDate.

💡 Its worth noting that the ExpirationDate must be a valid DateTime object.