How do you create a user to a specific OU using the Microsoft AD Spoke of Integration Hub Please help

Ambika  Sekar
Tera Contributor

Hi All,

Can anyone please help me , how can we add users to the Specifi OU in Mircrosoft AD using Servicenow Integration Spoke..

I have create user function where i can create users in AD but i dont have any filed OOB to specify the OU name there

find_real_file.png

 

Can anyone help if anybody has already done this...

Thank you....

9 REPLIES 9

That should work, be aware that you have to write down the full OU name like my previous example till your DC level. 

If my answer has helped with your question, please mark it as correct and helpful.

Kr!
Robin

Sravani36
Tera Expert

Hi Ambika you got solution for this I was working on the same?

 

Thanks

Sravani C

Robin
Tera Contributor

Hello,

 

I came across this thread while searching for a solution to create an AD user in a specific OU using the Microsoft AD Spoke in ServiceNow. I have successfully established a connection between AD and ServiceNow and tested it with one activity, which worked fine.

 

However, I am struggling to find a way to specify the OU path to the actions.

 

Did anyone manage to find a solution to this issue? Any guidance or updates would be greatly appreciated!

 

Thank you!

Hi Robin,

There is default action within the spoke for moving a computer to another OU "Move Computer To OU".
You could copy this and the powershell script make some adjustments and then it would also work for user. 

Changes you need to make are in the powershell script (so copy the script file as well). 
- replace computer variable for user variable and change those in the script as well. 
- search filter that objectClass=person

In the flow itself adjust the powershell action to use the right input and newly created (copied) script. 
Then adjust the last script step so that everywhere it says computer to replace it for user. 

Hope this helps! 

If my answer has helped with your question, please mark it as correct and helpful.

Kr!
Robin

Hello @Robin Bakker ,

Thank you so much for your reply.

Please review the changes below and let me know if I am doing it correctly:

Editaed the input like you suggested.

Robin_0-1720468112954.png

 

1]In the script step, I have replaced the username variable with computer.

 

 

Robin_1-1720468183847.png


2] In the PowerShell script step, I have added the username variable and provided the appropriate reference.

Robin_2-1720468311936.png
3] As you suggested, I have made the necessary changes in the script step.

Robin_3-1720468387047.png

 

However, I did not understand this part of your instructions: "In the flow itself adjust the PowerShell action to use the right input and newly created (copied) script." Could you please clarify what you mean by this?

 

Could you please guide me on how to proceed further if all the above changes are correct? Specifically, how can I integrate this into my AD flow and where should I specify the OU?

If you would like, we can discuss everything in my question thread as well: Link 

Please let me know as I am new to AD integration and your assistance would be very helpful.

Thank you!😊