-
The HelloID SA on-premises agent installed
-
The ActiveDirectory module is installed on the server where the HelloID SA on-premises agent is running.
This code snippet executes the following tasks:
- 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.
-
Imports the ActiveDirectory module.
-
Retrieve the user account object using the
Get-ADUser
cmdlet. -
Update the account using the
$user
object retrieved from step 3 and update theExpirationDate
.
💡 Its worth noting that the
ExpirationDate
must be a validDateTime
object.