locked
How do I set an AD User's Logon Hours using an attribute flow RRS feed

  • General discussion

  •   ILM Knowledge Bit

    In order to set an Active Directory user's logon hours, you could implement code like the following:

      Public Sub LogonHours( _
        ByVal csentry As CSEntry, _
        ByVal mventry As MVEntry _
      )
    
        Dim byteLogonHoursNone As Byte() = {&H0, &H0, &H0, &H0, &H0, &H0, 
          &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, 
          &H0}
    
        Dim byteLogonHoursAll As Byte() = {&HFF, &HFF, &HFF, &HFF, &HFF, 
          &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, 
          &HFF, &HFF, &HFF, &HFF, &HFF}
    
        Dim strLogonHours As String
    
        If mventry("employeeStatus").Value.ToUpper = "A" Then
          strLogonHours = Convert.ToBase64String(byteLogonHoursAll)
        Else
          'the status is not active - set all hours to none
          strLogonHours = Convert.ToBase64String(byteLogonHoursNone)
        End If
      
        csentry("logonHours").Value = strLogonHours
    
      End Sub

    This will set the available logon hours to either all or none, depending on the employee status as registered in the user's corresponding MV object. After implementing this code, you can call this subroutine from your export attribute flow.

      Go to the ILM Knowledge Bit Collection

    Paul Loonen (Avanade) | MCM: Directory 2008 | MVP: ILM
    Tuesday, June 29, 2010 9:42 PM