In a custom Active Roles Script Module, cmdlets which are executed against Microsoft Exchange in an onPostCreate handler do not throw an error message, but no operation is completed in Microsoft Exchange.
For example, the following script module could be used in an attempt to set the "AuditEnabled" for new mailbox users:
The onPostCreate handler is triggered after a User's Active Directory User Account is created. The Microsoft Exchange PowerShell is being sent and processed before this User's Microsoft Exchange mailbox exists.
This can be best handled by spawning a PowerShell Job or a PowerShell Runspace.
Have the job or runspace run a Sleep cmdlet and periodically check to see if Get-Mailbox returns a result. Once it does, send the desired cmdlets.
For more information on PowerShell Jobs, please see this resource.
For more information on PowerShell Runspaces, please see this resource.
For assistance with designing or implementing custom solutions, please contact One Identity Sales for information regarding engaging Professional Services and to obtain pricing.