How to use a wildcard in "Location" property of a "Create User" Active Directory activity?

I need to use Wildcard on the “Location” property of my “Create User” Active Directory activity because we create users on different folders of our AD depending on the Country, the City and the Cost Center they belong to.

I need to dynamize those two folders:

Having something similar to (like this it don’t work):

I also have problems with the “Users” folder because sometimes we have it (blue), sometimes not (orange):

Hello @Airun!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly

No one on the whole UiPath community knows hot to use wildcars on “Location” for AD activities? :flushed: :worried: :confounded:

This seems like it is an AD question, not a UiPath question. I am not sure, but I don’t think you can use wildcards in AD, it will just take everything literally?

I think your best bet is to parameterize the expression and find a way to get the location information somehow to include for each user.

In your variable, instead of the wildcard did you tried filling in the value with the correct info from the record. If you have the data for the country, city, etc. then try to put dynamic variables in there for those. Also, if you are getting errors with the string, make sure you include “.tostring” on the variables when combining with other strings.

Yes, filling it with the “correct” info it works, but I need it dynamic because the info will not be the same for all employees. If I put, for example, the data of IT team it works but we can’t use the process to create any employee that belongs to other teams.

I’ve found a way to have it more or less dynamic but it still don’t cover all our needs.


If I search for the “OU” with a “Get Objects by Filter” activity, I can use this output array variabe (UserFolderDN) on the “Location” field of the “Create User” activity (inserting UserFolderDN(0)) and it works. But, sometimes we need to create the users on this folder directly, and sometimes in a subfolder named “Users” contained on the team folder, so I’m trying to dynamize it too, I’m not sure about how to do it yet. :thinking:

Okey, I’ve found a way to do it, it works perfectly!! Just a little bit slow, it takes 16 seconds, but it doesn’t matter too much.

If anyone needs to do something equal or similar, here you have a way to do it:

  1. I use a “Get Objects by Filter” activity where I search for all “OU” (active directory folders, you can find AD attribute Distinguished Names here: Distinguished Names | Microsoft Learn) that are equal to “Users” so it gives me the list with all the Distinguished names of those folders.



  1. I loop (with an “If” activity for the filter) inside the list with a “For Each” activity to search if one of those results match the code of my team (Note: for this, in my company, I need to check only inside the first 22 characters of the Distinguished Names because some of our folders are contained inside other team folders so if I check the whole string I will have more than one result because it sometimes matches with the parent folder):


  1. On the “Then” part of my “If” activity, I’ve created a boolean variable named UsersFolderExists that will be False by default and will only be changed to True if we have a match here (that means our folder have a “Users” subfolder inside it) AND I will assign our Distinguished named that matched the condition to a string variable named UserFolder:


On the “Else” part we don’t have anything because we will find a lot of “User” folders that don’t match the condition in our AD and we don’t want any action to be performed for those folders.

  1. After that, I have an “If” activity that will execute actions only in case that we don’t had any match on the previous activity because it means that our team folder don’t have any “Users” subfolder inside. In this activity I use a “Get Objects by Filter” activity that will search for any folder existing on our Active Directory that contains the code of our team (we will allways have a unique result because we don’t have more than one folder with the same team code), so, after, I assign its Distinguished Name to our variable UserFolder:


  1. I build a Data Table with User properties (First Name, Last Name, E-mail Address…), for this I used the that I found on the topic IT Automation Activities for Active Directory Domain Services as template.

  2. Finally, I use the “Create User” activity using our variable UserFolder (that we filled with the correct dynamic Distinguished Name of the folder where we need to creat this user) as Location property:


Here you can see the complete Workflow view:


I hope this info will be usefull for someone!! :blush: :crossed_fingers:t2: :crossed_fingers:t2:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.