Imanami Community

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

Declaring Destination variable example

Last post 11-09-2007, 10:44 AM by Robert Haaverson. 7 replies.
Sort Posts: Previous Next
  •  11-06-2007, 6:41 AM 378

    Declaring Destination variable example

    I was wondering if anyone has a sample script declaring destination variables in the Global Script

     Thank you

  •  11-07-2007, 9:32 PM 404 in reply to 378

    Re: Declaring Destination variable example

    DTM uses VB.NET.  You can declare variables using the Dim statement:

    Dim sMyVariable As String = "This is a test"

    Does that help? 

  •  11-08-2007, 6:12 AM 405 in reply to 404

    Re: Declaring Destination variable example

    I was looking at your previous post and what we are trying to do is disable accounts but we want DTM to check if the account is already disabled in AD and if so do not touch the record. 

    Your previous post said to do the following: 

    Cast DTM.Destination to a DirectoryEntry and then you can access all the account's properties to make decisions.

    Dim destination As DirectoryEntry = CType(DTM.Destination, DirectoryServices.DirectoryEntry)

  •  11-08-2007, 9:35 AM 407 in reply to 405

    Re: Declaring Destination variable example

    DTM always checks the value before it sets the value.  If the value is the same it does not set the value.  However, the Disabled attribute is a pseudo attribute, it doesn't really exist in AD.  It a flag in UserAccountControl.  DTM will always set this bit regardless of the previous value.  Unfortunately, the destination does not appear to be exposed to script transforms, however it is accessible in the Global Script Editor and from PowerTools.  I don't see any harm in letting DTM disable and account that is already disabled though.  Do you?
  •  11-08-2007, 11:41 AM 412 in reply to 407

    Re: Declaring Destination variable example

    I agree but we have over 100 sites so would like to limit the number of changes to avoid traffic.  Do you have an example that i can reference to apply this using the Global Script Editor and power tools?
  •  11-08-2007, 9:03 PM 413 in reply to 412

    Re: Declaring Destination variable example

    An example is a tall order.  You have to bind to the destination object and cast it to a DirectoryEntry (using the example I gave you earlier).  THen you have to get the useraccountattribute and check if the disabled bit is on.  The disabled bit is 2.  All of this code would go in the Global Script Editor (GSE) which is passed the destinationobject as a parameter.  This is complicated stuff.

     I would recommend doing some testing with DTM to see if it causes replication when it disables a user who is already disabled.  DTM uses System.DirectoryServices, which in turn uses ADSI.  ADSI 2.5 used to be smart and would not cause replication if you set a value to the same value as the existing value.  My point is that it may not cause replication.  If the value of useraccountcontrol was 514 (disabled bit is true) and DTM sets it to 514 (to make sure it disabled), ADSI may ignore the change - at least it used to in an previous version.  If it works it will save you a lot of work.
     

     

  •  11-09-2007, 6:31 AM 415 in reply to 413

    Re: Declaring Destination variable example

    Yes seems complicated.  Another approach i was taking is i noticed there is an advanced option when creating a job that lets you update only records that have changed.  Not sure if this is possible as my source is Oracle and destination is AD but thought i would give it a try.  This is setup by using a query so was looking to query AD to see if the user is already disabled but I am not very good with writing SQL queries.  Any suggestions?
  •  11-09-2007, 10:44 AM 416 in reply to 415

    Re: Declaring Destination variable example

    DTM is not really conducive to SQL query testing (there's no execute button in the query editor).  I recommend using a stored procedure to return only the records you want to terminate.  I would modify the query/stored procedure to return accounts that have been terminated int he last 3 months.  That way if someone re-enables the account in AD, DTM will disable it again and it avoids returning every past employee in the database.
View as RSS news feed in XML
Powered by Community Server (Personal Edition), by Telligent Systems