Use case: Use this procedure when you need to onboard a hybrid user in a consistent and repeatable way, for example when employees join the organization. Automating the process via PowerShell allows you to schedule the process, run it in bulk, and couple it with additional steps to further customize the process.
To create a user from a virtual user template via PowerShell, use one of the EasyEntra built-in CmdLets:
Hybrid users
Invoke-EECreateHybridUserFromTemplate -Template <string> -DisplayName <string> [-Domain <string>]
Entra ID users
Invoke-EECreateEntraUserFromTemplate -Template <string> -DisplayName <string> [-Tenant <string>]
- Start a PowerShell 7 command prompt using the same credentials you use to run EasyEntra.
- The CmdLet reads AD and Entra ID settings and credentials from the EasyEntra configuration file stored in the Windows user profile.
- Run the script using the desired DisplayName and TemplateName
- Given name, surname, SamAccountName, UserPrincipalName, email alias, and email addresses are extrapolated from the display name and the formats used in the virtual user template.
- Review the output after the process completes, either manually or programmatically.
- Assign the output to a variable if you want to review it programmatically, e.g.,
$result = Invoke-EECreateHybridUserFromTemplate. - The overall completion status is available in the
Statusproperty[Completed | CompletedWithWarning | CompletedWithError | FatalError] - A detailed task log is available in the
TaskLogproperty of the result.
- Assign the output to a variable if you want to review it programmatically, e.g.,
To schedule the process, ensure the scheduled task runs in the security context of a user account with a local user profile that holds the EasyEntra configuration and authentication.
Make sure to protect the scheduled task so only authorized personnel can modify job settings.