Dim systemInfo as Object = CreateObject("ADSystemInfo")
Dim path as String = "LDAP://" & systemInfo.UserName
Dim entry as DirectoryEntry = New DirectoryEntry(path)
Debug.Print(entry.Properties("sn").Value)
Debug.Print(entry.Properties("givenName").Value)
Debug.Print(entry.Properties("displayName").Value)
Debug.Print(entry.Properties("badPwdCount").Value)
Dim path as String = "LDAP://" & UserPrincipal.CUrrent.DistinguishedName
Dim entry as DirectoryEntry = New DirectoryEntry(path)
Debug.Print(entry.Properties("sn").Value)
Debug.Print(entry.Properties("givenName").Value)
Debug.Print(entry.Properties("displayName").Value)
Debug.Print(entry.Properties("badPwdCount").Value)