Advanced attribute flow rule (Visual Basic)

This code can be found in Chapter 23 of Active Directory Cookbook, 2nd edition

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the Visual Basic code from this site.

    Select Case FlowRuleName
    Case "uid"
    If Not csentry("Last Name").IsPresent Then
          Throw New UnexpectedDataException("No Last Name!")
    End If

    If Not csentry("First Name").IsPresent Then
          Throw New UnexpectedDataException("No First Name!")
    End If

    mventry("uid").Value = csentry("First Name").StringValue.Substring(0, 1) + _
    csentry("Last Name").Value
                
    Case "cn"
       If Not csentry("Last Name").IsPresent Then
          Throw New UnexpectedDataException("No Last Name!")
       End If

       If Not csentry("First Name").IsPresent Then
          Throw New UnexpectedDataException("No First Name!")
       End If

       mventry("cn").Value = csentry("First Name").Value + " " + _
          csentry("Last Name").Value

    Case Else
       ' TODO: remove the following statement and add your default script here
          Throw New EntryPointNotImplementedException

    End Select

This code has been viewed 2375 times.

New from the creators of TechTasks.com: StatSheet.com