Unable to create Mailbox for newly created users using New QADUser command

I would like to create Exchange Mailbox using powershell script using New-QADUser. In Script, i used few virtual attributes like 'edsva-MsExch-MailboxType'=1;'edsva-MsExch-ApplyEmailAddressPolicy'='TRUE';'edsva-MsExch-ArchiveMailboxEnabled'='FALSE' . I'm able to create the users without mailbox option. 

Please let me know if you need any other information.

Thanks in advance!!

Parents
  • Hi kkm

    You would need to specify 'edsaCreateMsExchMailbox'=$true within your New-QADUser command.

    Also if you're not using Administration Policies to provide extra details like email address, or homeMDB automatically, you'd need to provide these also in you command, 

    With the Administration Policies in place, it would look like this:

    [Reflection.Assembly]::LoadWithPartialName("System.Web")
    $samAccountName = "UserA"
    $FirstName = "Albert"
    $LastName = "User"
    $Location = "OU=Users,OU=your,DC=yourdomain,DC=com"
    $UPNSuffix = "@yourdomain.com"
    $TempPassword = [System.Web.Security.Membership]::GeneratePassword(10,0)

    New-QADUser `
          -Name $samAccountName `
          -ParentContainer $Location `
          -UserPassword $TempPassword `
          -FirstName $FirstName `
          -LastName $LastName `
          -SamAccountName $samAccountName `
          -UserPrincipalName "$samAccountName@$UPNSuffix" `
          -ObjectAttributes @{'edsaCreateMsExchMailbox'=$true} `
          -Proxy

    Otherwise, it might look like this

    [Reflection.Assembly]::LoadWithPartialName("System.Web")
    $samAccountName = "UserA"
    $FirstName = "Albert"
    $LastName = "User"
    $Location = "OU=Users,OU=your,DC=yourdomain,DC=com"
    $UPNSuffix = "@yourdomain.com"
    $TempPassword = [System.Web.Security.Membership]::GeneratePassword(10,0)

    New-QADUser `
          -Name $samAccountName `
          -ParentContainer $Location `
          -UserPassword $TempPassword `
          -FirstName $FirstName `
          -LastName $LastName `
          -SamAccountName $samAccountName `
          -UserPrincipalName "$samAccountName@$UPNSuffix" `
          -Email "$samAccountName@$UPNSuffix" `
          -ObjectAttributes @{'edsaCreateMsExchMailbox'=$true;'homeMDB'="CN=Mailbox Database <some value>,CN=Databases,CN=Exchange Administrative Group (<some other value>),CN=Administrative Groups,CN=<Your org name>,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=yourdomain,DC=com"} `
          -Proxy

    Cheers

    Stu

  • Hi Stu,

    Thanks for the reply!!

    i tried below 2 command lines with 'edsaCreateMsExchMailbox'=$true and no user got created. If i run the command line 1 without 'edsaCreateMsExchMailbox'=$true then i'm able to see users were created.

    1. New-QADUser -FirstName $user.{First Name} -LastName $user.{Last Name} -Initials $user.{Middle Initial} -Name $name -DisplayName $user.{Display Name} -ParentContainer $container -Description $user.{Description Field} -UserPassword 'P@ssw0rd' -Title $user.Title -Department $user.{Department} -PhoneNumber $user.{Telephone} -Notes $user.{Telephone Notes} -ObjectAttributes @{pwdLastSet='0'; userAccountOption='ADS_UF_DONT_EXPIRE_PASSWD';accountExpires='TIMEQ_FOREVER';'edsaCreateMsExchMailbox'=$true}


    2. New-QADUser -FirstName $user.{First Name} -LastName $user.{Last Name} -Initials $user.{Middle Initial} -Name $name -DisplayName $user.{Display Name} -ParentContainer $container -Description $user.{Description Field} -UserPassword 'P@ssw0rd' -Title $user.Title -Department $user.{Department} -PhoneNumber $user.{Telephone} -Notes $user.{Telephone Notes} -ObjectAttributes @{'edsaCreateMsExchMailbox'=$true }

    Please let me know do i missing anything here or let me know if you need any other information of my script.

    Thanks,

    Kkm

Reply
  • Hi Stu,

    Thanks for the reply!!

    i tried below 2 command lines with 'edsaCreateMsExchMailbox'=$true and no user got created. If i run the command line 1 without 'edsaCreateMsExchMailbox'=$true then i'm able to see users were created.

    1. New-QADUser -FirstName $user.{First Name} -LastName $user.{Last Name} -Initials $user.{Middle Initial} -Name $name -DisplayName $user.{Display Name} -ParentContainer $container -Description $user.{Description Field} -UserPassword 'P@ssw0rd' -Title $user.Title -Department $user.{Department} -PhoneNumber $user.{Telephone} -Notes $user.{Telephone Notes} -ObjectAttributes @{pwdLastSet='0'; userAccountOption='ADS_UF_DONT_EXPIRE_PASSWD';accountExpires='TIMEQ_FOREVER';'edsaCreateMsExchMailbox'=$true}


    2. New-QADUser -FirstName $user.{First Name} -LastName $user.{Last Name} -Initials $user.{Middle Initial} -Name $name -DisplayName $user.{Display Name} -ParentContainer $container -Description $user.{Description Field} -UserPassword 'P@ssw0rd' -Title $user.Title -Department $user.{Department} -PhoneNumber $user.{Telephone} -Notes $user.{Telephone Notes} -ObjectAttributes @{'edsaCreateMsExchMailbox'=$true }

    Please let me know do i missing anything here or let me know if you need any other information of my script.

    Thanks,

    Kkm

Children
  • Hi Kkm

    Active Roles splits the UserAccountControl attribute into separate boolean virtual attributes

    New-QADUser `
         -FirstName $user.'First Name' `
         -LastName $user.'Last Name' `
         -Initials $user.'Middle Initial' `
         -Name $user.Name `
         -samAccountName $user.Name `
         -DisplayName $user.'Display Name' `
         -ParentContainer $container `
         -Description $user.'Description Field' `
         -UserPassword 'P@ssw0rd' `
         -Title $user.Title `
         -Department $user.Department `
         -PhoneNumber $user.Telephone `
         -Notes $user.'Telephone Notes' `
         -ObjectAttributes @{'edsaCreateMsExchMailbox'=$true;'edsaPasswordNeverExpires'=$false;'edsaUserCannotChangePassword'=$false;'edsvaUserMustChangePasswordAtNextLogon'=$true}

    In my command I also added "-samAccountName" as my email alias generation required upon it, and would be required anyway.

    Hope this helps

    Stu