Hello @Rising Flight
I am not really clear what your goal is. You can get aduser object using its Security Account Manager (samaccountname), distinguished name, SID, or GUID. Using Get-ADUser -Identity, you can get all of the properties for a specific user using Properties. You can get active directory user filter by user principal name. Or you are trying to find samaccountname from displayname with powershell?
Import-Csv C:\Data\Working\users.csv –Delimiter ";" | foreach {Get-ADUser –LDAPFilter "(ObjectClass=User)(anr=$($_.displayname))" –Properties displayname, SamAccountName} | select-Object displayname,SamAccountName | Export-Csv –Delimiter ";" C:\Data\Working\Users_DN_SAM.csv –NoTypeInformation
------------------
--If the reply is helpful, please Upvote and Accept as answer--