Get AD sAMAccountName from Display or Common Name

Hi there,
Is there any way to get sam account name from display or common name from an active directory. I have the display name of a user and i want to get its sam account name in uipath and i am not allowed to use powershell so any way i can do this using uipath activities?

Hi
i hope you mean the logon name which is same as username right , not sure and sorry if i m wrong
and there is no specific activity to do that

Cheers @rameezimtiaz

yes logon name. its same as samaccountname.

so as you said you have the username then we are good right
@rameezimtiaz

@rameezimtiaz

Try this.

       Environment.Username
1 Like

Hi @rameezimtiaz

So you have ANOTHER user’s display name, want the AD username, and can’t use Powershell.

You might be able to use LDAP. Check out the first solution here and pull what you need.

https://stackoverflow.com/questions/9845444/how-to-get-a-username-in-active-directory-from-a-display-name-in-c

Troy

@Palaniyappan im saying logon and samaccount name is same but i dont have it. i only have display name

@lakshman it works for windows. I want it for AD and not logged in user rather any user from the system. The input will be display name of the user

1 Like