Author Posts

December 15, 2017 at 7:43 pm

Need to edit the extension attributes for users. Example:
call csv that has column of: samaccountname
change: extensionAttribute1 to an ip: 1.1.1.1

The extension attributes are located within adsiedit for users and there are 15 extension attributes.

Your insight and help are greatly appreciated.

December 15, 2017 at 7:46 pm

Use Set-ADUser and pass a hash table to its -Property (or is it -Properties?) parameter, as shown in the help file examples.

December 15, 2017 at 7:48 pm

I know you are new to powershell based on your other post, but the best way to learn is to try!

Try writing some stuff and let us know where you run into problems.

Read these:

https://technet.microsoft.com/en-us/library/ee617241.aspx

https://blogs.technet.microsoft.com/heyscriptingguy/2013/12/22/powertip-set-custom-attributes-in-active-directory/

December 15, 2017 at 8:27 pm

Hey Don,

import-csv C:\users1.csv | % {set-aduser -identity $_.samaccountname -extensionattribute1 $_.extensionattribute1}
Set-ADUser : A parameter cannot be found that matches parameter name 'extensionattribute1'.
At line:1 char:70
+ ... {set-aduser -identity $_.samaccountname -extensionattribute1 $_.exte ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-ADUser], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.ActiveDirectory.Management.Commands.SetADUser

December 15, 2017 at 8:51 pm

got it with this.

import-csv C:\users1.csv | % {set-aduser -identity $_.samaccountname -Add @{extensionAttribute4="myString"}}

thanks all!