PowerShell Code: Change Multiple Users Attribute In AD With a .CSV File

In this article, I’ll show you a PowerShell code that changes multiple Users Job Title In Active Directory based on their Employee ID using a .CSV file.

Get Started

You can easily change Username, Email Address or anything that is unique to your users.

I used this script to change 4000 job titles to a customer.

Below, you see a sample of a CSV file and the code below.

My .CSV file looks like this.

employeeID,Title

55543,Project Manager

44522,Marketing Manager

Below, you will see the PowerShell Script:

$data = Import-Csv Title.csv

foreach ($m in $data)

{

$x = $m.employeeID

$y = $m.Title

Get-ADUser -Filter {employeeID -eq $x} | Set-ADUser -Title $y -Verbose

}

This article will be the first In a new section called PowerShell Code where I’ll showcase great scripts.

Hope you like it.


Posted

in

by