Get users SAMaccount name from Full name

Question:

I have a list of users full name that I’d like to get their SAMaccount name but when I run my code I get no results. Anyone have any ideas?

Answer:

It could be that $user is null inside the script block. Try to use double quotes instead of braces and put the variable in single quotes to make the valid query (name contain spaces):

Source:

Get users SAMaccount name from Full name by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply