Stop user creation in OnPreCreate event with PS script


I'm having a requirement to stop creating the user in OnPreCreate of powershell script.

If my condition is not satisfied then I have to stop the default user creation.

Thanks in Advance,

  • This seems like it can either be handled by a script, as you mentioned, or via a workflow.

    For the scripting route, there are some examples of halting scripts using the Throw cmdlet. Search the SDK help file for 'Understanding Event Handlers' or 'Applying Policy Scripts'. There are several PowerShell examples that stop specific operations from happening.