在 vba 中是否可以离线检查 Active Directory 组成员资格?
我已经管理了在线和离线用户凭据检查(用户名、密码)。
在线 = 到公司域网络(LAN 或 Wifi)的第 3 层连接
离线 = 没有物理网络连接 - 没有 LAN,没有 Wifi
Public Declare Function LogonUser Lib "advapi32" Alias "LogonUserA" _
(ByVal lpszUsername As String, ByVal lpszDomain As String, ByVal lpszPassword As String, _
ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, phToken As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Const LOGON32_PROVIDER_DEFAULT As Long = 0&
Public Const LOGON32_LOGON_INTERACTIVE As Integer = 2&
Public Function ADUserLogin(ByVal strUsername As String, ByVal strPassword As String, _
ByVal strDomain As String) As Boolean
On Error GoTo ADUserLogin_Error
Dim tokenHandle As Long
ADUserLogin = LogonUser(strUsername, strDomain, strPassword, LOGON32_LOGON_INTERACTIVE, _
LOGON32_PROVIDER_DEFAULT, tokenHandle)
CloseHandle tokenHandle
On Error GoTo 0
Exit Function
ADUserLogin_Error:
MsgBox "Error " & Err.Number & " (" & Err.description & ") in procedure ADUserLogin, line " & Erl & "."
End Function
但它对 Active Directory 组成员身份有何作用?
亲切的问候罗尼