Copying all extensionattributes from one user to another

We use a lot of extensionAttributes in my AD environment and wanting a simple command to copy all from one user to another so they are not missed or typed wrong when creating a new user. Below is how my mind sees it working but cant quite figure it out.


Get-ADUser [USER] -Properties * | select extensionAttribute* | ForEach-Object …

Set-ADUser has a so called Instance method (Parameter set -Instance). Please read the complete help including the examples to learn how to use it. It’s explained in the first paragraphs and in example #5.