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

Robin Bakker
Kilo Guru

Hi Ambika,

I made a custom action for that with a few parameters. It runs a powershell script via mid server to place the user in the right OU. 

If the user type for example is of a "kiosk" user then the OU is this 
Otherwise the user is a full user and then move it to another OU. 

This is the code. 

import-module activedirectory;

if($user_type -eq "KIOSK"){
    Get-ADUser -Server $computer -Identity $sAMAccountName | Move-ADObject -TargetPath "OU=KioskUsers,OU=xxx,OU=xx,OU=xx,OU=xxx,DC=xx,DC=xx"
}
if($user_type -eq "FULL"){
    Get-ADUser -Server $computer -Identity $sAMAccountName | Move-ADObject -TargetPath "OU=Users,OU=xxx,OU=xxx,OU=xxx,DC=xxx,DC=xxx"
}

Hope this helps. 

Kind regards,
Robin

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

Kr!
Robin

Hi Robin can you please share the screenshot of your flow how it worked, i have the same requirement.

Hi Sravani,
Even better to use the OOTB action within flow designer. 

RobinBakker_0-1665731083341.png

 

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

Kr!
Robin

Hi Robin this flow will work as below

Sravani36_0-1665732311853.png