How can I Do... Update Extension attribute

Hi, I have a Script to update some values in Active Directory from a CSV file, and works fine...

Import-Module ActiveDirectory

Import-CSV C:\Test\Users.csv  |

ForEach-Object {
         $record = $_
         $s = @{}
            if ($record.empnum) {$s["EmployeeID"] = $record.empnum }
            if ($record.Phone) {$s["OfficePhone"] = $record.phone }
     ... etc...

     Get-ADUser -filter "Name -eq `"$($_.nameusr)`"" | Set-ADUser @s

}

Now the challenge is update some data to "extension attribute", so I try with some like:

     if ($record.usrID) {$s["extensionAttribute5"] = $record.usrID }

But i have this error:

Set-ADUser : A parameter cannot be found that matches parameter name 'extensionAttribute5'

Any suggestions on how to do this?

Tks

July 15th, 2015 1:18am

Set-ADUser -Identity SamAccountName -Replace @{extensionAttribute5="SomeValue"}

Look at EXAMPLE 6:

Set-ADUser

Free Windows Admin Tool Kit Click here and download it now
July 15th, 2015 2:37am

Set-ADUser -Identity SamAccountName -Replace @{extensionAttribute5="SomeValue"}

Look at EXAMPLE 6:

Set-ADUser

July 15th, 2015 2:43am

You are mixing incompatible methods.

Import-CSV C:\Test\Users.csv  |
     ForEach-Object {
          $user=Get-AdUser $_.nameusr
          if ($_.empnum  ){$user.EmployeeID  = $_.empnum }
          if ($_.Phone   ){$user.OfficePhone = $_.phone }
          ... etc...
          Set-ADUser -Instance $user
}
Free Windows Admin Tool Kit Click here and download it now
July 15th, 2015 5:46am

Set-ADUser -Identity SamAccountName -Replace @{extensionAttribute5="SomeValue"}

Look at EXAMPLE 3 and EXAMPLE 6:

Set-ADUser

July 15th, 2015 6:35am

Set-ADUser -Identity SamAccountName -Replace @{extensionAttribute5="SomeValue"}

Look at EXAMPLE 3 and EXAMPLE 6:

Set-ADUser

Free Windows Admin Tool Kit Click here and download it now
July 15th, 2015 6:35am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics