I tried things out and not with much success. I don't want to know the whole solution for this problem, but where should I start (or maybe there already exist a solution)? Should I better convert the excel file to CSV or XML? Or maybe should I put some C# in it ?
Here are some more details:
$path = "C:\Scripts\05-Script\Contacts.csv"
$Database = "xDB"
$OU = "XUnit/Test"
#$Password = (Get-Credential).Password
$Password = ConvertTo-SecureString "P@ssWord1" -AsPlainText -Force
Import-Csv $path | ForEach-Object {
$FirstName = $_."FirstName"
$LastName = $_."LastName"
$Alias = $_."Alias"
$UserPrincipalName = $Alias # +xdomain.com"
$OtherEmail = $FirstName +"."+ $LastName + "@xdomain.com"
$DisplayName = $LastName+", "+$FirstName
New-Mailbox -Alias $Alias `
-Name $Alias `
-FirstName $FirstName `
-LastName $LastName `
-DisplayName $DisplayName `
-SamAccountName $Alias `
-UserPrincipalName $UserPrincipalName `
-Database $Database `
-OrganizationalUnit $OU `
-Password $Password `
-ResetPasswordOnNextLogon $false
}