Update AD User properties via CSV file in powershell

Zeeshan Qaiser Opel 41 Reputation points
2022-04-19T04:39:56.68+00:00

Import-Module ActiveDirectory

$USERS = Import-CSV c:\users.csv

$empid=$USERS.employeeid
$company=$USERS.company
$title=$USERS.title
$department=$USERS.department
$Division=$USERS.division
$pobox=$USERS.pobox
$city=$USERS.city

$USERS|Foreach{
Set-ADUSer -Identity $_.samaccountname -Replace @{employeeID=$empid; company=$company; title=$title; department=$department; division=$division; postofficebox=$pobox; l=$City}
}

but I am getting insufficient rights issue where as I am an enterprise admin.

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

5 additional answers

Sort by: Most helpful
  1. Gardian Memeti 0 Reputation points
    2023-01-13T11:02:52.0366667+00:00

    I wanted to test it only for one user and to change the companyName how can I achieve it

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.