# Newbie and need a little help copying custom attribute data over to another

**URL:** https://forums.powershell.org/t/newbie-and-need-a-little-help-copying-custom-attribute-data-over-to-another/8037
**Category:** PowerShell Help
**Created:** [February 10, 2017, 9:46pm UTC](https://forums.powershell.org/t/newbie-and-need-a-little-help-copying-custom-attribute-data-over-to-another/8037 "2017-02-10T21:46:57Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![kelly-farrell](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@kelly-farrell](https://forums.powershell.org/u/kelly-farrell)
#### Post date: [February 10, 2017, 9:46pm UTC](https://forums.powershell.org/t/newbie-and-need-a-little-help-copying-custom-attribute-data-over-to-another/8037/1 "2017-02-10T21:46:57Z")

</div>

I have 2 custom attributes called saConcurID and another saSkillportid and I want saConcurID = saSkillportid and this is what I have but it doesn’t like it. Set-ADUser : A parameter cannot be found that matches parameter name ‘Idenity’.

Import-Module ActiveDirectory - ErrorAction stop

$users = Get-ADUser -SearchBase “OU=blah,OU=blah,OU=blah,DC=blah,DC=blah,DC=com” -filter \* -properties cn, saconcurid, saskillportid| Select-Object cn, saconcurid, saskillportid

foreach ($user in $users) {

```
   Set-ADUser -Idenity $user -Replace @{saconcurid = "$($_.saskillportid)"}

```

}

---

<div class="post-metadata">

### Author: ![daniel-krebs](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/daniel-krebs/32/484_2.png) [@daniel-krebs](https://forums.powershell.org/u/daniel-krebs)
#### Post date: [February 11, 2017, 2:04am UTC](https://forums.powershell.org/t/newbie-and-need-a-little-help-copying-custom-attribute-data-over-to-another/8037/2 "2017-02-11T02:04:38Z")

</div>

Typo! Idenity should be Identity. You can also us the pipeline to pass in the user.

$user | Set-ADUser -Replace @{saconcurid = $user.saskillportid}

---

<div class="post-metadata">

### Author: ![kelly-farrell](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@kelly-farrell](https://forums.powershell.org/u/kelly-farrell)
#### Post date: [February 11, 2017, 8:53am UTC](https://forums.powershell.org/t/newbie-and-need-a-little-help-copying-custom-attribute-data-over-to-another/8037/3 "2017-02-11T08:53:36Z")

</div>

it was only a typo here I typed it correct in my script but I will try your suggestion, thanks

I just tried that and get set-ADUser : Object reference not set to an instance of an object

---

<div class="post-metadata">

### Author: ![aapeli-hietikko](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@aapeli-hietikko](https://forums.powershell.org/u/aapeli-hietikko)
#### Post date: [February 12, 2017, 3:26pm UTC](https://forums.powershell.org/t/newbie-and-need-a-little-help-copying-custom-attribute-data-over-to-another/8037/4 "2017-02-12T15:26:36Z")

</div>

Hi,

I’m not verifying your script more than fix the $users statement.

$users = Get-ADUser -SearchBase “OU=blah,OU=blah,OU=blah,DC=blah,DC=blah,DC=com” -filter \* -properties cn, saconcurid, saskillportid| Select-Object cn, saconcurid, saskillportid

to

$users = Get-ADUser -SearchBase “OU=blah,OU=blah,OU=blah,DC=blah,DC=blah,DC=com” -filter \* -properties cn, saconcurid, saskillportid

Your select-object kills the ad-object object type. Old school mistake which I run from time to time when getting only the output I want, just to see that it kills the script.

---

<div class="post-metadata">

### Author: ![poshcodebear](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/poshcodebear/32/525_2.png) [@poshcodebear](https://forums.powershell.org/u/poshcodebear)
#### Post date: [February 12, 2017, 10:11pm UTC](https://forums.powershell.org/t/newbie-and-need-a-little-help-copying-custom-attribute-data-over-to-another/8037/5 "2017-02-12T22:11:52Z")

</div>

If there’s a performance concern (one reason to trim output, if you’re dealing with a large number of users), you could leave the select statement, but add “samaccountname”. Then, specify the samaccountname property for your identity:

```
$users = Get-ADUser -SearchBase "OU=blah,OU=blah,OU=blah,DC=blah,DC=blah,DC=com" -filter * -properties cn, saconcurid, saskillportid| Select-Object cn, saconcurid, saskillportid, samaccountname

foreach ($user in $users) {

Set-ADUser -Idenity $user.samaccountname -Replace @{saconcurid = "$($_.saskillportid)"}
}
```

Either way works; if there isn’t a performance issue you’re trying to overcome, though, I’d just leave Select-Object out. Get-ADUser already returns a limited set of properties by default.

---

<div class="post-metadata">

### Author: ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)
#### Post date: [May 16, 2024, 8:39pm UTC](https://forums.powershell.org/t/newbie-and-need-a-little-help-copying-custom-attribute-data-over-to-another/8037/6 "2024-05-16T20:39:15Z")

</div>


