none
Active directory attributes change

    Question

  • Hi

    I am about to change attribute number 15 (extension attribute) to for example value General

    For one user

    set-ADUser -Identity john -Add @{extensionAttribute15="General"}

    and for one user this works well

    but lets say if i want to change for example for 5 users that are in completely different OUs is it possible under identity put several names or it has to be done from CSV which is what I am trying to avoid because requirements are changing

    for example i have now user john but lets say if i want to type 5 other users is it possible or it has to be done from CSV

    

    Dalibor Bosic

    Monday, February 6, 2017 6:41 PM

Answers

  • or for example if i want to just set it by OU


    Dalibor Bosic

    This one is easy enough

    get-aduser -filter * -searchbase "OU=Example,OU=Example2,DC=contoso,DC=COM" -Properties * | set-aduser -Add @{extensionAttribute15="Genera"}

    • Edited by SYN_ACK_87 Wednesday, February 15, 2017 7:55 PM
    • Proposed as answer by AlvwanModerator Monday, February 20, 2017 2:02 AM
    • Marked as answer by cer113 Thursday, March 2, 2017 8:15 PM
    Wednesday, February 15, 2017 7:54 PM
  • used AD Modify on this and this changed it for everyone

    Dalibor Bosic

    • Marked as answer by cer113 Wednesday, February 22, 2017 8:51 PM
    Wednesday, February 22, 2017 8:50 PM

All replies

  • If there's nothing the users currently have in common, then you have a few options.

    # Just put them all in a comma separated list with quotes around each name and pipe. "user1","user2","user3","user4","user5" | get-aduser -Properties * | set-aduser -Add @{extensionAttribute15="Genera"}

    # Have a text file with the names

    get-content C:\Temp\users.txt | % {get-aduser -properties * | set-aduser -add @{extensionAttribute15="General"}



    • Edited by SYN_ACK_87 Monday, February 6, 2017 6:54 PM
    • Proposed as answer by SYN_ACK_87 Monday, February 6, 2017 6:54 PM
    Monday, February 6, 2017 6:53 PM
  • Simplest way to do it:-

    You can load all the users in a txt/csv file lets say under c:\users\users.txt. Then in shell browse to this drive/location. Inside users.txt, load teh users displayname or samaccountname or emailaddress

    Get-content users.txt | set-aduser -Add @{extensionAttribute15="General"}

    to retrieve info if they are correctly set:-

    Get-ADUser -Filter {extensionattribute15 -like "*@*"} | select displayname

    Monday, February 6, 2017 6:55 PM
  • Hi,

    Just checking in to see if the information provided was helpful. Please let us know if you would like further assistance.

    Best Regards,

    Alvin Wang


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

    Friday, February 10, 2017 6:38 AM
    Moderator
  • what fields i need in CSV file how I would export this to csv there are different methods is the name of the user enough or I need DN name

    Dalibor Bosic

    Wednesday, February 15, 2017 6:44 PM
  • or for example if i want to just set it by OU


    Dalibor Bosic

    Wednesday, February 15, 2017 7:02 PM
  • or for example if i want to just set it by OU


    Dalibor Bosic

    This one is easy enough

    get-aduser -filter * -searchbase "OU=Example,OU=Example2,DC=contoso,DC=COM" -Properties * | set-aduser -Add @{extensionAttribute15="Genera"}

    • Edited by SYN_ACK_87 Wednesday, February 15, 2017 7:55 PM
    • Proposed as answer by AlvwanModerator Monday, February 20, 2017 2:02 AM
    • Marked as answer by cer113 Thursday, March 2, 2017 8:15 PM
    Wednesday, February 15, 2017 7:54 PM
  • what fields i need in CSV file how I would export this to csv there are different methods is the name of the user enough or I need DN name

    Dalibor Bosic

    If you're trying to export to CSV, you need to know what values you want to export.  To go back and reference a user account later, all you really need is the SAMAccountName value, so combining that with your OU request:

    get-aduser -filter * -searchbase "OU=Example,DC=Contoso,DC=com" -properties * | select SamAccountName,ExtensionAttribute15 | export-csv -notypeinformation -path C:\temp\users.csv

    Wednesday, February 15, 2017 7:57 PM
  • used AD Modify on this and this changed it for everyone

    Dalibor Bosic

    • Marked as answer by cer113 Wednesday, February 22, 2017 8:51 PM
    Wednesday, February 22, 2017 8:50 PM
  • i have most of users in Users component so that will not work

    get-aduser -filter * -searchbase "OU=Users,DC=contoso,DC=COM" -Properties * | set-aduser -Add @{extensionAttribute15="Genera"}


    Dalibor Bosic

    Wednesday, February 22, 2017 9:10 PM