Hi @Eaven HUANG ,
please try this script if it fits your requirements:
$Username = "mmouse"
$groups = "Group1","Group2"
$DN = ((Get-ADUser -Identity $Username).DistinguishedName).Split(",",2)[1]
$OUname = Get-ADOrganizationalUnit -Identity $DN -Properties * | select name
$employeeID = ((Get-ADUser -Identity $Username -Properties *).EmployeeID)
Set-ADUser $Username -Description (($employeeID) + " " + $($OUname.Name))
$groups | ForEach-Object {Add-ADPrincipalGroupMembership (Get-ADUser -Identity $Username) -MemberOf $_}
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten