locked
Need to creat PS script to change/update users department under organization tab in AD RRS feed

  • Question

  • this is what I have so far:

    Get-ADUSER x.xxx -Properties Department | Set-AdUser -Replace @{department="ABC123"} ****Changes using attributes

    now if this is correct how would I go about using a csv file since the users that need this change are in different OUs

    

    Thursday, June 29, 2017 2:34 AM

All replies

  • You need to learn basic PowerSHell.

    Start here:

    help about_foreach
    help Import-Csv -Full

    And here: https://www.youtube.com/watch?v=XiGGb5v8yAo&t=25s


    \_(ツ)_/

    Thursday, June 29, 2017 2:59 AM
  • Hi,

    >>how would I go about using a csv file since the users that need this change are in different OUs

    Get-ADUSER-filter * -Properties Department | Set-AdUser -Replace @{department="ABC123"} 

    or:

    $users = import-csv .\users.csv
    foreach($user in $users)
    {
       Get-ADUSER -Identity $user -Properties Department | Set-AdUser -Replace @{department="ABC123"}  
    }
    # .\users.csv contains appropriate DN

    Best regards,

    Andy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, June 30, 2017 5:45 AM