question

Abdelloukan-0643 avatar image
0 Votes"
Abdelloukan-0643 asked Abdelloukan-0643 answered

What is wrong? How can I Fix it?

Issue scripting:

Import-CSV address BulkuserMailboxes.csv | ForEach {New-Mailbox -Alias
$ .alias -Name $.name -userPrincipalName $.UPN -Database “Mailbox Database 2091411052” -OrganizationalUnit Users -Password $Password}

csv text:
Alias Name UPN
Bulkuser_1 Bulkuser1 bulkuser1@extraining.com
Bulkuser_2 Bulkuser2 bulkuser2@extraining.com

errorr:154187-image.png


windows-server-powershelloffice-exchange-server-administration
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Without knowing what problem you're having it's impossible to tell you how to fix it!

I don't see where you assign a value to the variable $password. Could that be the problem? Or maybe that the CSV doesn't use a comma as the separator character?

Also, when you post code, please use the "Code Sample" editor. It's the 5th icon from the left on the Format Bar (it has the graphic "101 010"). The normal editor mangles the code.

0 Votes 0 ·
KyleXu-MSFT avatar image
0 Votes"
KyleXu-MSFT answered

@Abdelloukan-0643

This screenshot is not visible.

So, I provide a script which could work in my lab:

CSV file:
154266-qa-kyle-10-06-06.png

Script:

 $users = Import-CSV c:\temp\users.csv
 $PassWord = ConvertTo-SecureString -String "Password123" -AsPlainText -Force
    
 ForEach($user in $users){
     New-Mailbox -Alias $user.alias -Name $user.name -userPrincipalName $user.UPN -Database "DB16" -OrganizationalUnit Users -Password $Password -ResetPasswordOnNextLogon $true
 }

Run this script(.PS1 file) in EMS:
154268-qa-kyle-10-05-34.png


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Abdelloukan-0643 avatar image
0 Votes"
Abdelloukan-0643 answered

thank you guys, for some strange reason , excel worked notepad did not. Was prop the PS mode

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.