Imanami Community

Join or create discussions about common issues and solutions.
Welcome to Imanami Community Sign in | Join | Help
in Search

Moving AD Accts to another OU

Last post 04-07-2008, 9:04 AM by Asmith. 7 replies.
Sort Posts: Previous Next
  •  11-09-2007, 6:21 AM 414

    Moving AD Accts to another OU

    We are trying to automate DTM to move user account if/when a user changes deparmtents.  I know this is possible with the power tools but does anyone have a sample script?
  •  11-09-2007, 12:12 PM 417 in reply to 414

    Re: Moving AD Accts to another OU

    Edit the global script and add the Active Directory PowerTool.  I would recommend moving the user after the update, so use the Row_Changed event:

    sub DTM_RowChanged(dtmsource As Object, args As JobEventArgs) handles DTM.RowChanged
     ' User-definable script goes here -----------------

    'Check if Department attribute has been changed.

    If DTM.OriginalDestination("Department").Trim().ToLower() <> DTM.StagingDestination("Department").Trim().ToLower() Then

    'Department attribute is changing so let's move the user

    Select Case DTM.Source("Department").Trim().ToLower()

    Case "sales"

    ActiveDirectoryTool.MoveObject("LDAP://OU=HR,DC=fabrikam,DC=com")

    Case Else

    'Do nothing

    End Select

    End If

     ' -------------------------------------------------
    end sub

  •  11-12-2007, 6:36 AM 418 in reply to 414

    Re: Moving AD Accts to another OU

    I get a few compile errors: 

    'OriginalDestination' is not a member of 'Imanami.Dtm.Scripting.IScriptingObject'

    'StagingDestination' is not a member of 'Imanami.Dtm.Scripting.IScriptingObject'

    Name 'ActiveDirectoryTool' is not declared

  •  11-13-2007, 1:44 PM 419 in reply to 418

    Re: Moving AD Accts to another OU

    Did you add the ActiveDirectory PowerTool to the GSE?  You need the ActiveDirectory PowerTool.dll.  You can add it to the GSE by clicking Add References.
  •  11-13-2007, 2:36 PM 420 in reply to 419

    Re: Moving AD Accts to another OU

    How would I get this ActiveDirectory PowerTool.dll ? What other PowerToll.dll's are availible and how do I get them?

    Jay Brophy 

     

    Did you add the ActiveDirectory PowerTool to the GSE?  You need the ActiveDirectory PowerTool.dll.  You can add it to the GSE by clicking Add References.

     

     

  •  11-15-2007, 5:36 AM 422 in reply to 420

    Re: Moving AD Accts to another OU

    I also can't locate ActiveDirectory PowerTool.dll
  •  01-05-2008, 1:46 AM 445 in reply to 422

    Re: Moving AD Accts to another OU

    Attached is a document covering the ActiveDirectory PowerTool in detail.  The document includes instructions on how to get the PowerTool.

    --Robert

  •  04-07-2008, 9:04 AM 566 in reply to 445

    Re: Moving AD Accts to another OU

    The script still wasn't compiling after adding the AD power tool so did the following modifications <<dtmsource.OriginalDestination("City").Trim().ToLower()>>(as seen below) but when I run the job it fails.

    sub DTM_RowChanged(dtmsource As Object, args As JobEventArgs) handles DTM.RowChanged
     ' User-definable script goes here -----------------
    'Check if City attribute has been changed.

    If dtmsource.OriginalDestination("City").Trim().ToLower() <> dtmsource.StagingDestination("City").Trim().ToLower() Then

    'City attribute is changing so let's move the user

    Select Case DTM.Source("CITY").Trim().ToLower()

    Case "TORONTO"

    ActiveDirectoryTool.MoveObject("LDAP://OU=DTM2,DC=LAB,DC=LOCAL")

    Case Else

    'Do nothing

    End Select

    End If
     ' -------------------------------------------------
    end sub

View as RSS news feed in XML
Powered by Community Server (Personal Edition), by Telligent Systems