When i googled a bit i came uppon this code for a similar situation.
$user = "user"
$manager = Get-Aduser $user -Properties manager | Select-Object -ExpandProperty Manager
Switch -wildcard ($manager){
"*Manager Name*" {Set-ADUser -Identity $user -Replace @{extensionAttribute4="Bagelphobia"} -WhatIf}
}
Now my question would be if someone knew of a way to adapt this so that the Computer name will be passed into a custom attribute of the User. Computer owners are written in the description, so i thought this might be used to specify to which account the pc is linked.
Also how would you run such a script?