# {host}を接続先のADのIPに書き換え
$domain = "LDAP://{host}:389"
$auth = [System.DirectoryServices.AuthenticationTypes]::FastBind
# {DN}を接続先のにドメインのDNに書き換え {User}、{Password}を接続用のユーザ情報で書き換え
$root = New-Object System.DirectoryServices.DirectoryEntry($domain,"{DN}\\{User}", "{Password}", $auth)
$query = New-Object System.DirectoryServices.DirectorySearcher($root,"(objectclass=*)")
$entries = $query.FindAll()
# ADで管理しているエントリーが出力される
$entries | %{$_.Properties}
More than 5 years have passed since last update.
System.DirectoryServices.dllを使って、PowershellからActive Directoryへに接続
Last updated at Posted at 2019-03-26
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme