Recently a friend of mine was doing a deployment of Office 365 in a hybrid environment with Exchange 2013.
There was a CSV file with the required fields, and he asked me to help him create a script to create the users.
I did him one better, and also enabled the mailboxes on 365 for him.
$Users = Import-Csv -Path "C:\Users.csv"
$OU = read.host "What OU would you like the users created in?"
$domain = read.host "What is your domain?"
$Password = read.host "What password would you like to set all accounts to?"
foreach ($User in $Users)
{
$Displayname = $User.Firstname + " " + $User.Lastname
$UserFirstname = $User.Firstname
$UserLastname = $User.Lastname
$SAM = $User.Username
$UPN = $User.Firstname + "." + $User.Lastname + "@" + $domain
$Mobile = $User.Mobile
$Home = $User.PersonalEmail
New-ADUser -Name "$Displayname" -DisplayName "$Displayname" -SamAccountName $SAM -UserPrincipalName $UPN -GivenName "$UserFirstname" -Surname "$UserLastname" -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Enabled $true -Path "$OU" -ChangePasswordAtLogon $false –PasswordNeverExpires $true -MobilePhone $Mobile -HomePhone $Home
$RemoteRouting = "smtp:" + $UPN
Enabled-RemoteMailbox $SAM -RemoteRoutingAddress $RemoteRouting
}
A quick run through.
The script will prompt the OU path where you want to create the users, the domain and the password you want to use.
It then creates the account, with the fields populated by the CSV file.
Those fields are Firstname, Lastname, Username, Mobile, PersonalEmail
Once the account is created, it will then create the mailbox on 365.
All that's left to do is assign the licenses.
Quick sidenote: while running through the script in the lab worked well without problem, in production we could not run the script more than once without requiring a restart of EMS.
This comment has been removed by the author.
ReplyDeletebitcoin nasıl alınır
ReplyDeletetiktok jeton hilesi
youtube abone satın al
gate io güvenilir mi
referans kimliği nedir
tiktok takipçi satın al
bitcoin nasıl alınır
mobil ödeme bozdurma
mobil ödeme bozdurma
kadıköy mitsubishi klima servisi
ReplyDeletekartal vestel klima servisi
ümraniye vestel klima servisi
beykoz daikin klima servisi
üsküdar daikin klima servisi
kadıköy daikin klima servisi
kartal toshiba klima servisi
ümraniye toshiba klima servisi
kartal beko klima servisi