Bulk change the employee ID from a .csv file

NYAdmin 1 Reputation point
2022-07-25T14:04:16.923+00:00

I have a csv file with a list of (student)employee ID that are set incorrect and we need to update them to the new ID in the CSV file. I get an error message saying cannot find an object with Identity.

$Students = Import-Csv -Delimiter "," -Path "C:\Users\admin\Desktop\StudentIDChangeTest.csv"
foreach ($Student in $Students)
{
$SAM = $Student.USERNAME
$StudentID = $Student.STUDENTID
Set-ADUser $SAM -Add @{employeeID="$StudentID"}
}

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,374 questions
Microsoft Entra
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,471 questions
{count} votes