Simple script help needed


Need to add the letter “T” in front of user id number in AD

We have a new attribute in AD named ABCID this filed contains a 7 digit number 1650325

When we terminate a employee we need to add the letter T to the beginning on the ABCID number


$term = “T”
get-aduser -identity test -properties abcid | set-aduser -replace @{ ‘abcid’ = $($term + $abcid)}

When I run this all I get is a “T”

Any ideas on why? would like T1650325

Thank you






Hmmm … and the name of this new attribute is really “ABCID”?

I don’t know if there’s an even more sophisticated way but I know this works usually:

term = "T"
Get-ADUser -Identity test -Properties abcid | 
    ForEach-Object {
        Set-ADUser -Identity _ -replace @{ abcid = (term + _.abcid) }


That worked

No abcid is not the real name of the attribute I did not want to put the real name on here it is confidential company information.

Thanks again