cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Desktopper
Regular Visitor

Active Directory - Get User - Distinguished name (DN): How to deal with blank spaces?

Greetings,

 

I'm trying to use Power Automate to automate some (on-premise) Active Directory tasks and everything has been working fine, but I'm stumbling upon the issue that the "Get User" action from the Active Directory category in Power Automate does not work when the CN of the user contains blank spaces.

 

For example, this works fine:

CN=HollyAbbington,OU=Employees,OU=Users,DC=Contoso,DC=Central

 

But, the following DN does NOT work:

CN=Holly\ ,Abbington,OU=Employees,OU=Users,DC=Contoso,DC=Central

 

When trying to do so, I get the error that the entry can't be found in AD. 

 

Clearly, the issue is caused by "\,"  between Holly and Abbington, which is the effect of the displaynames of our users in AD consisting of "First name {blank space} Last Name". 

 

How can I fix this issue? Do I have to replace the "\," with a different symbol so that Power Automate recognizes it? Is there any workaround?

 

Regards,

11 REPLIES 11
Desktopper
Regular Visitor

None? 😶

Desktopper
Regular Visitor

Already tried a few other common blank-replacements symbols such as %, emitting the symbol entirely or using CN instead, but none of it works 🙁

Desktopper
Regular Visitor

Still dealing with the issue. Is there really none who knows a solution for this? I've also checked a few old topics regarding similar issues but they too were unsolved 😕

ekarim2020
Super User
Super User

No experience with on-premise AD with Power Automate (didn't know it supported it, are you using Power Automate Desktop?).

Can you try something like:

CN='Holly Abbington',OU=Employees,OU=Users,DC=Contoso,DC=Central

or

'CN=Holly Abbington,OU=Employees,OU=Users,DC=Contoso,DC=Central'

Or use a variable to hold the user's CName ?

CN=VariableName,OU=Employees,OU=Users,DC=Contoso,DC=Central

 

Ellis

Yes, using Power Automate Desktop

 

Tried them both, also using " instead of ' but it didn't help, same problem with the variable

 

Thanks for the suggestion though!

ekarim2020
Super User
Super User

Something else to try:

Jim Smithcn=\ Jim Smith \ ,ou=West,dc=MyDomain,dc=com

 

https://social.technet.microsoft.com/wiki/contents/articles/5312.active-directory-characters-to-esca...

Many years ago I used VbScript to perform AD and Windows tasks.

Ellis

Looked promising but sadly it didn't work ☹️

ekarim2020
Super User
Super User

😡

PhilippS91
New Member

Hey pls try this = 

CN="Holly\ ,Abbington",OU=Employees,OU=Users,DC=Contoso,DC=Central

Cologne_Claret
Advocate IV
Advocate IV

Just remove the "\" and put " around the name - just had the same issue and this resolved for me (if you have the space before the comma then change as in the second version below):

CN="Holly, Abbington",OU=Employees,OU=Users,DC=Contoso,DC=Central
CN="Holly ,Abbington",OU=Employees,OU=Users,DC=Contoso,DC=Central

 

assuming that you have successfully connected to AD using:

LDAP://DC=Contoso,DC=Central

 

I would use Lastname, Firstname, so in my case it would be:

CN="Abbington, Holly",OU=Employees,OU=Users,DC=Contoso,DC=Central

 

instead of:

CN=Abbington\, Holly,OU=Employees,OU=Users,DC=Contoso,DC=Central

 

but verify the Distinguished Name first.

 

Here is some helpful info:
Active Directory - Power Automate | Microsoft Docs

Thoman
Helper II
Helper II

We have user accounts in different OUs.... is there a way to find the DN in a Desktop Flow? Like search for the user first and then use Unlock?

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,117)