MS Active Directory, Bulk export and import of Attributes

Опубликовано: 24 Октябрь 2024
на канале: Aleksandrs Mortulevs
7,478
36

In this video we will do Active Directory, Bulk export and import of Attributes
#text in description of video#

In concrete task, - Office 365, Skype for Business users need proxyAddresses attribute to be able login using e-mail address.
But in the same way can export and import other attributes.

1. we will export list of users with specific e-mail addresses
2. will import for each user additional attribute, - proxyAddresses (same as e-mail address)

Prerequisites:
1. Install "Active Directory Module for Windows PowerShell" locally or open Active Directory server -
https://theitbros.com/install-and-imp...

Steps:
2. Run "Active Directory Module for Windows PowerShell" as Administrator
3. export users
Import-Module ActiveDirectory
Get-ADUser -Filter {mail -Like "*@domain.com"} -Properties * | Select-Object cn, mail, proxyAddresses
Get-ADUser -Filter {mail -Like "*@domain.com"} -Properties * | Select-Object cn, mail | export-csv c:\temp\Users.csv -Encoding UTF8
4. prepare user list for import
find & replace..
5. check script
6. run
7. check results
Get-ADUser -Filter {mail -Like "*@domain.com"} -Properties * | Select-Object cn, mail, proxyAddresses

Additional info:

Script file - UsersImp_script.ps1
###
#Calling the Import ActiveDirectory module
Import-Module ActiveDirectory

#Setting the parameters/variables
$ImportUser = Import-CSV "C:\temp\Users.csv"

Foreach ($user in $ImportUser){

$u = Get-ADuser -Identity $user."cn"
$u | Set-ADUser -Add @{proxyaddresses=$user.proxyAddresses -split ";"}
}
###

File, Users-example.csv
###
"cn","proxyAddresses"
"userA","sip:[email protected]"
"userB","sip:[email protected]"
"userC","sip:[email protected]"
###

Thank you!
Regards,
Alexander