ソフトウェア開発 / Active Directory

Active Directory

ユーザープロパティ

グループプロパティ

SID履歴

SID履歴とは

スクリプト

未整理

現在ログオンしているユーザーの情報を取得する方法

方法1

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)

方法2

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)

方法3

Debug.Print(UserPrincipal.CUrrent.Surname)
Debug.Print(UserPrincipal.CUrrent.GivenName)
Debug.Print(UserPrincipal.CUrrent.DisplayName)
Debug.Print(UserPrincipal.CUrrent.BadLogonCount)

ユーザー名とパスワードが有効かどうかを検証する方法

方法1

Dim context As PrincipalContext = New PrincipalContext(ContextType.Domain)
context.ValidateCredentials(userName, password)

トップ   一覧 検索 最終更新   ヘルプ   最終更新のRSS