Ok,
There is some code that comes with the GALSync.
1. Code is located %Program Files/Forefront Identity Manager/2010/Synchronization Service/SourceCode
2. Assuming not other customizations or code changes have been made, you should be able to Open "GALSync.sln" in Visual Studio and make the changes to GALMV.vb
3. Section you need to modify is below. I am pasting the before and after changes code.
4. Rebuild the code and test the solution
------------------------Before--------------
Public Sub Provision( _
ByVal mventry As MVEntry) _
Implements IMVSynchronization.Provision
Dim i As Integer
Dim MasterConnector As CSEntry = Nothing
Dim MA As ConnectedMA
Log("Entering provisioning for " & mventry.ToString)
For Each MA In mventry.ConnectedMAs
Dim csentry As CSEntry
For Each csentry In MA.Connectors
If csentry.ConnectionRule = RuleType.Projection Then
MasterConnector = csentry
End If
Next
Next
'
' For every MA, try to add a csentry, if there is not already one
'
For i = 0 To galMAs.Length - 1
MA = mventry.ConnectedMAs(galMAs(i).MAName)
If 0 = MA.Connectors.Count Then
'
' If there were no connectors, then we are going to add one
'
AddOrRenameConnector(MA, galMAs(i), mventry)
ElseIf 1 = MA.Connectors.Count Then
'
' If there is one connector,
' - if it is the master object connector then it is ok.
' - if it is a replica object, then check for rename.
' - if it is a join object outside the Synchronization
' OU, then it is a problem, log it
'
Dim csentry As CSEntry = MA.Connectors.ByIndex(0)
If IsInSynchronizationOU(csentry) Then
AddOrRenameConnector(MA, galMAs(i), mventry, csentry)
Else
If Not csentry Is MasterConnector Then
'
' This object has joined.
'
Dim LogString As String = _
"A contact for this object " _
& MasterConnector.ToString _
& " called contact " & csentry.ToString _
& " already exists in forest represented by MA " _
& MA.Name _
& ". If you would like to preserve this " _
& "contact and have us manage it, please " _
& "move the contact into Synchronization OU. " _
& "If you would like us to create " _
& "a new contact and manage it, " _
& "please delete this one."
Log(LogString)
End If
End If
Else
'
' We have more than one connectors undert the same MA,
' print an error message.
'
Dim csentry As CSEntry
Dim index As Integer
Dim countCsRemaining As Integer = 0
Dim contactOutsideSyncOU As Boolean = False
Dim LogString As String = _
"Multiple or outside-synchronizaiton-OU " _
& "connector(s) for the MV object " _
& MasterConnector.ToString _
& "exist, they are: "
For index = MA.Connectors.Count - 1 To 0 Step -1
csentry = MA.Connectors.ByIndex(index)
If csentry.ConnectionRule = RuleType.Provisioning Then
Log("Disconnecting provisioned " & csentry.ToString)
csentry.Deprovision()
Else
countCsRemaining = countCsRemaining + 1
LogString = LogString & csentry.ToString _
& " lives in forest connected by " _
& MA.Name & " "
If Not IsInSynchronizationOU(csentry) _
AndAlso csentry.ObjectType = CONTACT Then
contactOutsideSyncOU = True
End If
End If
Next
'
' If we end up with more than one connector, or
' any contact outside synchronization OU,
' we want to log a warning message
'
If (countCsRemaining > 1) _
OrElse (True = contactOutsideSyncOU) Then
LogString = LogString _
& ". Please refer to documentation " _
& "to resolve the conflict."
Log(LogString)
End If
End If
Next
End Sub
------------------------After----------------
Public Sub Provision( _
ByVal mventry As MVEntry) _
Implements IMVSynchronization.Provision
Dim i As Integer
Dim MasterConnector As CSEntry = Nothing
Dim MA As ConnectedMA
Log("Entering provisioning for " & mventry.ToString)
For Each MA In mventry.ConnectedMAs
Dim csentry As CSEntry
For Each csentry In MA.Connectors
If csentry.ConnectionRule = RuleType.Projection Then
'Nosh Code Added. DOMAIN_C_ATT_NAME=Name of your attribute that identifies the users to be filtered
If mventry("DOMAIN_C_ATT_NAME").ToLower().Equals("something")) Then
'End Of Nosh Code Added
MasterConnector = csentry
'Nosh Code Added
End If
'End of Nosh Code Added
End If
Next
Next
'
' For every MA, try to add a csentry, if there is not already one
'
For i = 0 To galMAs.Length - 1
MA = mventry.ConnectedMAs(galMAs(i).MAName)
If 0 = MA.Connectors.Count Then
'
' If there were no connectors, then we are going to add one
'
AddOrRenameConnector(MA, galMAs(i), mventry)
ElseIf 1 = MA.Connectors.Count Then
'
' If there is one connector,
' - if it is the master object connector then it is ok.
' - if it is a replica object, then check for rename.
' - if it is a join object outside the Synchronization
' OU, then it is a problem, log it
'
Dim csentry As CSEntry = MA.Connectors.ByIndex(0)
If IsInSynchronizationOU(csentry) Then
AddOrRenameConnector(MA, galMAs(i), mventry, csentry)
Else
If Not csentry Is MasterConnector Then
'
' This object has joined.
'
Dim LogString As String = _
"A contact for this object " _
& MasterConnector.ToString _
& " called contact " & csentry.ToString _
& " already exists in forest represented by MA " _
& MA.Name _
& ". If you would like to preserve this " _
& "contact and have us manage it, please " _
& "move the contact into Synchronization OU. " _
& "If you would like us to create " _
& "a new contact and manage it, " _
& "please delete this one."
Log(LogString)
End If
End If
Else
'
' We have more than one connectors undert the same MA,
' print an error message.
'
Dim csentry As CSEntry
Dim index As Integer
Dim countCsRemaining As Integer = 0
Dim contactOutsideSyncOU As Boolean = False
Dim LogString As String = _
"Multiple or outside-synchronizaiton-OU " _
& "connector(s) for the MV object " _
& MasterConnector.ToString _
& "exist, they are: "
For index = MA.Connectors.Count - 1 To 0 Step -1
csentry = MA.Connectors.ByIndex(index)
If csentry.ConnectionRule = RuleType.Provisioning Then
Log("Disconnecting provisioned " & csentry.ToString)
csentry.Deprovision()
Else
countCsRemaining = countCsRemaining + 1
LogString = LogString & csentry.ToString _
& " lives in forest connected by " _
& MA.Name & " "
If Not IsInSynchronizationOU(csentry) _
AndAlso csentry.ObjectType = CONTACT Then
contactOutsideSyncOU = True
End If
End If
Next
'
' If we end up with more than one connector, or
' any contact outside synchronization OU,
' we want to log a warning message
'
If (countCsRemaining > 1) _
OrElse (True = contactOutsideSyncOU) Then
LogString = LogString _
& ". Please refer to documentation " _
& "to resolve the conflict."
Log(LogString)
End If
End If
Next
End Sub