Here is what I want to do
- I am reading users from different ADs into my MIM 2016. I am also exporting the users to different Ads.
- I have some environmental variables that I would like to set based on the source object.
- I do not want to put these variables in my VB code. There should be flexibility so that the Admin can add new information or change existing ones.
- I want to search in the xml config for some identifier of the user and then read the variables I want.
- I want the Admin to be able to specify which Management agent not to provision to.
The xml config file
<DocumentElement>
<Table1>
<DestinationMA>TLK1 GAL MA</DestinationMA>
<OriginatingForest>tlk1.com</OriginatingForest>
<OUMapping> OU=TLK1Users,DC=tlkenterprise1,DC=net</OUMapping>
<Ldap>LDAP://DC=tlkenterprise1,DC=net </Ldap>
</Table1>
<Table1>
<DestinationMA>TLK2 GAL MA</DestinationMA>
<OriginatingForest>tlk2.com</OriginatingForest>
<OUMapping> OU=TLK2Users,DC=tlkenterprise1,DC=net</OUMapping>
<Ldap>LDAP://DC=tlkenterprise2,DC=net </Ldap>
</Table1>
<Table2>
<DoNotProvision>TLK3 GALSync MA</DoNotProvision>
</Table2>
</DocumentElement>
The code
-
Dim OUDataSet As New DataSet
-
‘Get the OU config data
-
Dim dir As String = Utils.ExtensionsDirectory
-
OUDataSet.ReadXml(dir + “\tlkconfig.xml”)
-
Dim adminGroup As String = Nothing
-
Dim okayToProvision As Boolean = False
-
Dim ProvCollection As Array = Nothing
-
Dim adminCollection As Array = Nothing
-
Dim MA As ConnectedMA
-
Dim myOriginatingForest As String = mventry(“msExchOriginatingForest”).Value.ToLower()
-
Dim myOrganizationalUnit As String = Nothing
-
-
‘We want to prevent any contacts or persons from being provisioned based on xml config info
-
‘Get the restricted Prov MA from the Xml file
-
ProvCollection = OUDataSet.Tables(“Table2”).Select(“DoNotProvision='” + MA.Name + “‘”)
-
-
‘Check to see if there is a matching MA in the xml file
-
If ProvCollection.Length <> 0 Then
-
Exit Sub
-
End If
-
-
‘Get the DN from the xml config
-
adminCollection = OUDataSet.Tables(“Table1”).Select(“DestinationMA='” + MA.Name + “‘
-
and “ + “OriginatingForest='” + myOriginatingForest + “‘”)
-
‘Check to see if there is a matching forest in the xml file
-
If adminCollection.Length = 0 Then
-
Throw New ArgumentException(“No value returned in xml file when
-
finding originating forest in mapping file = “ + myOriginatingForest + ” “ + MA.Name)
-
End If
-
If adminCollection.Length <> 0 Then
-
For Each item As DataRow In adminCollection
-
‘Set the DN value
-
myOrganizationalUnit = item(“OUMapping”).ToString()
-
Next
-
End If