This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Create or Move Exchange Mailbox with Workflow

Hello,


we are using ActiveRoles Version 7.

We want to automate User creation with workflows, but i have problems with the Mailbox creation.

We want to minimize the Rules we are using, so my Test approach is on Policy and after this the Settings are applied to the new user depending of the OU where the user is created.

With Mailbox creation i have tested the following:
1. Workflow sets the attributes mailnickname and homeMDB; in a later Step edsaCreateMsEchangeMailbox --> not working with Error Message "external Mail Address is missing"

2. created a default Policy with automatic creation of the Mailbox in the selected Store, the Workflow sets edsahomeMDB and edsaMoveMailbox "True" --> Error edsahomeMDB is missing

3. created a default Policy with automatic creation of the Mailbox in the selected Store, the Workflow sets extensionAttribute8 with the DN of the correctStore; a second Workflow starts a script which reads the User DN, extensionAttribute8 and mailNickname and starts "Set-QADUser $user -Proxy -ObjectAttributes @{"edsaMoveMailbox"=$true;"edsaHomeMDB"=$strEDSAhomeMDB}" --> Error Access Denied"

When i start a powershell with the User of our ActiveRoles Server Service the command "Set-QADUser $user -Proxy -ObjectAttributes @{"edsaMoveMailbox"=$true;"edsaHomeMDB"=$strEDSAhomeMDB}" works fine.

Does someone has a solution or concept for this ?

Is there some way to delete a moverequest from exchange when it is finished ?


Regards,

Florian Ballangó

Parents
  • Hello,

    i have found the solution, thanks to Aidar and jhonnyquest.

    I have customized the Webinterface "Create User" Wizard with the extensionAttribute6 as dropdown with "Yes" and "No". I use this Attribute to control the Mailbox Creation with the Script

    Create a new Powershell Script in ActiveRoles with the following Content:

    <Script>
    function onPostCreate($Request)
    {
    # set next Value to one for Debug output
    $Debug = "0"
    # Start only if User
    if($Request.Class -eq "user")
        {

    # Set Default Variables:

    $MDB_Database1 = "CN=Database1,CN=Databases,CN=Exchange Administrative Group (Number),CN=Administrative Groups,CN=Company,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Domain,DC=Local"
    $MDB_Database2 = "CN=Database2,CN=Databases,CN=Exchange Administrative Group (Number),CN=Administrative Groups,CN=Company,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Domain,DC=Local"
    # Read User from Request
          $user = '"'                                                       # Add " as first character / enclosed with ' and '
            $user += $Request.DN
            $user += '"'                                                   # Add " as last character / enclosed with ' and '
                    if($Debug -eq "1")
                    {
                    Out-File  C:\Request.txt -Append -InputObject $user
                    }

    # Read ExtensionAttribute6 --> is set with a dropdown at user Create with yes or no

            $strAttr6 = $Request.Get("extensionAttribute6")

    if($strAttr6 -eq "Yes")

        {

    # Set Mailboxstore depending of the organizational Unit where the User is created


        if (($user -like "*OU=1,DC=Domain,DC=local*") -or ($user -like "*OU=2,DC=Domain,DC=local*"))
        {
        $edsaHomeMDB = $MDB_Database1
        } elseif (($user -like "*OU=3,DC=Domain,DC=local*") -or ($user -like "*OU=3,DC=Domain,DC=local*"))
        {
        $edsaHomeMDB = $MDB_Database2
        }

    # Set Variables to User Object

                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "homeMDB", $edsaHomeMDB)
                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "edsaHomeMDB", $edsaHomeMDB)
                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "edsaCreateMsExchMailbox", $true)

    # IF ExtensionAttribute6 = other than "Yes" clear Mailbox Settings

            } else {
               
                $edsaHomeMDB = $null
                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "homeMDB", $edsaHomeMDB)
                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "edsaHomeMDB", $edsaHomeMDB)
                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "edsaCreateMsExchMailbox", $null)
               
                    }
            }
    }
    </Script>

    Create a Workflow with Target Object "User" and select Action "create".
    In the empty Workflow you have the green Startpoint/Arrow and as Text with gray background the "Operation execution: Create User".

    Add the previous cretated Script between the green Arrow and the Operation execution.

Reply
  • Hello,

    i have found the solution, thanks to Aidar and jhonnyquest.

    I have customized the Webinterface "Create User" Wizard with the extensionAttribute6 as dropdown with "Yes" and "No". I use this Attribute to control the Mailbox Creation with the Script

    Create a new Powershell Script in ActiveRoles with the following Content:

    <Script>
    function onPostCreate($Request)
    {
    # set next Value to one for Debug output
    $Debug = "0"
    # Start only if User
    if($Request.Class -eq "user")
        {

    # Set Default Variables:

    $MDB_Database1 = "CN=Database1,CN=Databases,CN=Exchange Administrative Group (Number),CN=Administrative Groups,CN=Company,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Domain,DC=Local"
    $MDB_Database2 = "CN=Database2,CN=Databases,CN=Exchange Administrative Group (Number),CN=Administrative Groups,CN=Company,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Domain,DC=Local"
    # Read User from Request
          $user = '"'                                                       # Add " as first character / enclosed with ' and '
            $user += $Request.DN
            $user += '"'                                                   # Add " as last character / enclosed with ' and '
                    if($Debug -eq "1")
                    {
                    Out-File  C:\Request.txt -Append -InputObject $user
                    }

    # Read ExtensionAttribute6 --> is set with a dropdown at user Create with yes or no

            $strAttr6 = $Request.Get("extensionAttribute6")

    if($strAttr6 -eq "Yes")

        {

    # Set Mailboxstore depending of the organizational Unit where the User is created


        if (($user -like "*OU=1,DC=Domain,DC=local*") -or ($user -like "*OU=2,DC=Domain,DC=local*"))
        {
        $edsaHomeMDB = $MDB_Database1
        } elseif (($user -like "*OU=3,DC=Domain,DC=local*") -or ($user -like "*OU=3,DC=Domain,DC=local*"))
        {
        $edsaHomeMDB = $MDB_Database2
        }

    # Set Variables to User Object

                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "homeMDB", $edsaHomeMDB)
                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "edsaHomeMDB", $edsaHomeMDB)
                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "edsaCreateMsExchMailbox", $true)

    # IF ExtensionAttribute6 = other than "Yes" clear Mailbox Settings

            } else {
               
                $edsaHomeMDB = $null
                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "homeMDB", $edsaHomeMDB)
                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "edsaHomeMDB", $edsaHomeMDB)
                $Request.PutEx($Constants.ADS_PROPERTY_UPDATE, "edsaCreateMsExchMailbox", $null)
               
                    }
            }
    }
    </Script>

    Create a Workflow with Target Object "User" and select Action "create".
    In the empty Workflow you have the green Startpoint/Arrow and as Text with gray background the "Operation execution: Create User".

    Add the previous cretated Script between the green Arrow and the Operation execution.

Children
No Data