• Products
    • View all products
    • Free trials
  • Solutions
    • All Solutions
    • All Integrations
  • Resources
    • All Resources
    • Learning Hub
  • Trials
  • Support
    • Support Home
    • By Product
      • All Products
      • Active Roles
      • Authentication Services
      • Cloud Access Manager
      • Defender
      • Identity Manager
      • Password Manager
      • Safeguard
      • Starling Identity Analytics & Risk Intelligence
      • Starling Two-Factor Authentication
      • TPAM Appliance
    • Contact Support
      • Overview
      • Customer Service
      • Licensing Assistance
      • Renewal Assistance
      • Technical Support
    • Download Software
    • Knowledge Base
    • My Account
      • My Products
      • My Service Requests
      • My Licenses
      • My Groups
      • My Profile
    • Policies & Procedures
    • Professional Services
    • Technical Documentation
    • One Identity University
    • User Forums
    • Video Tutorials
  • Partners
    • Overview
    • Partner Circle Log In
    • Become a Partner
    • Find a Partner
    • Partner Community
  • Communities
    • Home
    • Blogs
      • Blogs A to Z
      • One Identity Community
      • AD Account Lifecycle Management
      • Cloud
      • Identity Governance & Administration
      • Privileged Access Management
      • syslog-ng Community
    • Forums
      • All Product Forums
      • Active Roles
      • Identity Manager
      • Password Manager
      • Safeguard
      • Unix Access Management
    • Social Networks
      • Facebook
      • LinkedIn
      • Twitter
      • YouTube
One Identity Community
One Identity Community
  • Site
  • User
  • Site
  • Search
  • User
Active Roles Community
Active Roles Community
Wiki How to enable cross-domain moving of user accounts
  • Forum
  • Ideas
  • Wiki
  • More
  • Cancel
  • New
  • -Active Roles Script Center
    • +Active Roles Script Policy Best Practices
    • Active Roles SDK
    • +C#
    • +JavaScript
    • +PowerShell
    • -VBScript
      • VBScript Library source code
      • -VBScript samples
        • A Managed Unit with users which have not logged on for last 90 days
        • Adjust the case of usernames to title case (first letter of each part of the name)
        • Advanced group creation/provision
        • Advanced shared folder creation
        • Bulk policy incompliance fixing
        • Check unique value of an attribute
        • +Computer management
        • +Exchange management
        • Function that converts regular date into integer8 format
        • Get effective policy info list
        • +Group management
        • How to find a request source in script policy
        • How to send emails based on scripts policy parameters and Virtual Attribute values
        • +Permissions Management
        • Policy incompliance reporting & fixing for specified policy
        • Populate values from a SQL database to an AD Attribute
        • Prevent copying an attribute on user copy
        • Prohibite a permission propagation to AD
        • Prohibite an AD native security editing
        • Read large integer date attributes and display them in date and time readable format
        • Read XML Node text or attribute value
        • Read XML Node with Children into DictionaryObject
        • Standalone script that requests built-in password generation policy
        • -User management
          • Copy additional attributes on user copy
          • Create/Delete local user accounts, basing upon creation/deletion of user accounts in Active Directory
          • Custom script-based PVG-policy with generation rule
          • Custom script-based PVG-policy with possible values list
          • Custom script-based User Logon Name Generation policy
          • Delete Expired Users and Home Directory
          • Detailed debug information on the script policy request object
          • Function to get a DN of a user object using samAccountName
          • Get user account properties after it had been deleted
          • How to enable cross-domain moving of user accounts
          • How to enforce the use of the "Generate Password" function
          • How to prevent Active Roles interaction with file servers on User Home Folder Provision
          • How to prohibit specifying a user password that never expires
          • Last Bad Password Time
          • Manage country codes, names and abbreviations
          • Move a user to some OU upon creation
          • Notify manager when user object is deprovisioned
          • Populate a PVG policy with a possible values list from external source
          • Populate user attributes based on another attribute - e.g. 'Company'
          • Programmatically deprovision a user
          • Re-locates users according to a value set in a virtual attribute
          • Remove characters with an umlaute (öäü) and replace with corresponding characters
          • Restrict who can Disable users while allowing Enable
          • Review for user personal data
          • Script Policy to set account expiration for every created user account
          • Script-based "Last N characters of X attribute"-rule as part of User Logon Name Generation policy rules
          • Set correct country code for user
          • Simplified version of the script-based PVG-policy with a possible values list
          • Stamping manager DN by given manager Id
          • Standalone script to set logon hours of a user account
          • Tree of trust - allow objects to be managed only by their direct or indirect managers
          • User logon name generation without national characters
          • User Provisioning - Home Drive Location and Profile based on UserID
        • Validate moving operations
        • +VBScript: Approval

How to enable cross-domain moving of user accounts

DESCRIPTION

Active Roles has the ability to move a user account between domains, but by default, this ability is hidden on the user interface. Possible, an error will be raised during cross-domain moving if a moving user is a member of a global group. To avoid that, a user membership should be cleared before cross-domain moving.

Technical notes:

  1. We can't remove a group from a user membership directly. We should remove a user from the group.
  2. The cross-domain move is always made from source DC that have the RID master role. This behavior is defined in Active Directory by Microsoft, and we can't change it.

Thus we should clear a user membership on the RID master DC rather than other Domain Controllers. This will allow us to move a user account to another domain instantly, without any delay for domain replication between DCs.

This script demonstrates how to enable cross-domain moving, and how to clear a user membership before moving to another domain.


Note This code may use functions from the Active Roles Script Policy Best Practices. Please, follow the link to obtain instructions and code for those functions.


SCRIPT

'*********************************************************************************

' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,

' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

'

' IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,

' PLEASE CONTACT ONE IDENTITY PROFESSIONAL SERVICES.

'*********************************************************************************

Option Explicit

'***********************************************************************************

'** EVENT HANDLERS

'***********************************************************************************

Function onGetPolicyMarker()

'-- Identify your policy with the same policy ID that is used for a built-in policy

onGetPolicyMarker=EDS_APE_TYPE_MOVE_TARGETS

End Function

Sub onPostGet(Request)

'-- Optimization: process user account only

If (LCase(Request.Class) <> "user") Then Exit Sub

'-- Optimization: respond to target container requests only

If (Not Request.IsAttributeRequested("edsvaMoveTargets")) Then Exit Sub

'-- Provide a list of target allowed target containers

Call Request.PutEx(ADS_PROPERTY_UPDATE, "edsvaMoveTargets", _

Array ("DC=testenv,DC=msk,DC=lab", "DC=orange,DC=msk,DC=qsft"))

End Sub

Sub onPreMove(Request)

'-- Optimization: process user account only

If (LCase(Request.Class) <> "user") Then Exit Sub

Call ClearMembership()

End Sub

'***********************************************************************************

Sub ClearMembership()

Dim strDN, strDomainDN, objEDMS, objGroup

Dim arrMemberOfDN, strMemberOfDN, strObjectCategory, boolIsDynamicGroup

Dim objRIDMasterFsmo, objRIDMasterFsmoNTDS, objRIDMasterFsmoServer, strRIDMasterFsmoServer

Call DirObj.GetInfoEx(Array("distinguishedName", "memberOf", "edsvaDomainDN"), 0)

'-- Get a user account membership

On Error Resume Next

arrMemberOfDN = DirObj.GetEx("memberOf")

On Error GoTo 0

'-- Skip if a membership is empty

If (IsEmpty(arrMemberOfDN)) Then Exit Sub

'-- Get a user account distinguished name

On Error Resume Next

strDN = DirObj.GetEx("distinguishedName")

On Error GoTo 0

'-- Get a user account domain distinguished name

strDomainDN = DirObj.Get("edsvaDomainDN")

'-- Get a FSMO RID Server

Set objRIDMasterFsmo = GetObject("EDMS://CN=RID Manager$,CN=System," & strDomainDN)

Set objRIDMasterFsmoNTDS = GetObject("EDMS://" & objRIDMasterFsmo.Get("fSMORoleOwner"))

Set objRIDMasterFsmoServer = GetObject(objRIDMasterFsmoNTDS.Parent)

strRIDMasterFsmoServer = objRIDMasterFsmoServer.Get("dNSHostName")

'-- Get a EDMS provider

Set objEDMS = GetObject("EDMS:")

For Each strMemberOfDN In arrMemberOfDN

'-- Bind for each object of membership

Set objGroup = objEDMS.OpenDSObject("EDMS://" & strRIDMasterFsmoServer & "/" & strMemberOfDN, vbNullString, vbNullString, ADS_SERVER_BIND)

Call objGroup.GetInfoEx(Array("objectCategory", "edsaIsDynamicGroup"), 0)

'-- Get an object category

On Error Resume Next

strObjectCategory = objGroup.Get("objectCategory")

On Error GoTo 0

'-- Process groups only

If (StringStartsWith(LCase(strObjectCategory), LCase("CN=Group,CN=Schema,CN=Configuration"))) Then

'-- Get an info if a group is dynamic

On Error Resume Next

boolIsDynamicGroup = CBool(objGroup.Get("edsaIsDynamicGroup"))

On Error GoTo 0

'-- Skip dynamic groups

If (Not boolIsDynamicGroup) Then

'-- Remove a user account from the group

Call objGroup.PutEx(ADS_PROPERTY_DELETE, "member", strDN)

Call objGroup.SetInfo()

End If

End If

Next

End Sub

Function StringStartsWith(ByVal strWhere, ByVal strWhat)

StringStartsWith = (Left(strWhere, Len(strWhat)) = strWhat)

End Function

'***** END OF CODE ***************************************************************

  • Script Center
  • Script Center: VBScript
  • Share
  • History
  • More
  • Cancel
Related
Recommended
  • Company
    • About Us
    • Buy
    • Careers
    • Contact Us
    • News
  • Resources
    • Blogs
    • Customer Stories
    • Documents
    • Events
    • Videos
  • Support
    • Professional Services
    • Renew Support
    • Technical Support
    • One Identity University
    • Support Service
  • Social Networks
    • Facebook
    • Instagram
    • LinkedIn
    • Twitter
    • YouTube
  • © 2025 One Identity LLC. ALL RIGHTS RESERVED.
  • Legal
  • Terms of Use
  • Privacy
  • Community Feedback & Support
  • Cookie Preference Center