I'm trying to make a power shell script that will ask for a user name & then insert a list of the AD groups the specified user is a member of into the notes field in the telephone tab for the specified user.
I keep getting an empty notes field & this is what I've got so far .
$UserID is just a string and has no MemberOf property, in the first one (though you could fetch the user and get that property from Get-ADUser). MemberOf contains distinguished names, though, which might get a bit wordy in your notes attribute.
Your second version looks closer to working, and would . Maybe try this: