Migrate user accounts from Azure AD to on-premise AD

Export User and Shared Mailboxes from 365 Exchange Admin

import-csv C:\TEMP\Export\User.csv -Encoding UTF8 | foreach-object {New-ADUser -Name ($_.DisplayName) -SamAccountName ($_.Alias) -Company $_.Company -GivenName $_.FirstName -Surname $_.LastName -City $_.City -Department $_.Department -DisplayName $_.DisplayName -Fax $_.Fax -MobilePhone $_.MobilePhone -Office $_.Office -PasswordNeverExpires ($_.PasswordNeverExpires -eq "True") -PostalCode $_.PostalCode -EmailAddress $_.PrimarySmtpAddress -State $_.State -streetAddress $_.streetAddress -Title $_.Title -UserPrincipalName $_.PrimarySmtpAddress -Path "OU=Users,OU=XXXXXX,DC=domain,DC=local" -OfficePhone $_.Phone -AccountPassword (ConvertTo-SecureString -string "Dasf34rRFSA&" -AsPlainText -force) -enabled $true }

import-csv C:\TEMP\Export\User.csv -Encoding UTF8 | foreach-object {Set-aduser -Identity $_.Alias -add @{proxyaddresses = $_.EmailAddresses} }

import-csv C:\TEMP\Export\User.csv -Encoding UTF8 | foreach-object {Set-ADUser -Identity $_.Alias -streetAddress $_.streetAddress -OfficePhone $_.Phone}
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...