ServiceNow AD orchestration

V V Satyanaray1
Tera Contributor

Hi Everyone,

 

I'm currently working on ServiceNow AD orchestration. I want to know if it's possible to change a user's Organization Unit(OU) using any orchestration activities OOB.

 

Specifically:

  • Is there any predefined activity that supports changing the OU of an AD user?
  • Can we use the "Update AD Object" activity for this purpose? If yes, which attribute needs to be updated.

Thanks in advance!

3 REPLIES 3

J Siva
Tera Sage

Hi @V V Satyanaray1 
If your service account has all the necessary access to modify the user OU in AD, then you can run the below custom powershell cmdlet on yiur mid server.

# Replace with the user's distinguished name (DN)
$userDN = "CN=JohnDoe,OU=OldOU,DC=example,DC=com"

# Replace with the target OU where the user should be moved
$targetOU = "OU=NewOU,DC=example,DC=com"

# Move the user to the new OU
Move-ADObject -Identity $userDN -TargetPath $targetOU

# (Optional) Verify the move by getting the user's new OU
Get-ADUser -Identity $userDN | Select-Object DistinguishedName, Name, ObjectClass

 

Regards,
Siva

Hi @J Siva ,

Thanks for the reply,

 

we have necessary access to modify the user OU in AD. Do I need to create a  new activity for this and add this script in mid server script file ?

If yes, could you please let me know how do I pass input values to process the data

 

Regards,

Satya

Hi @V V Satyanaray1 
Yes, you need to create new mid server script file.
If you're trying this using Flow Designer, I can help you with that, as I'm not familiar with Workflow.
Regards,
Siva