powershell でユーザー取得
よく忘れるので。
$targetAccountName="ユーザーアカウント" $root = New-Object DirectoryServices.DirectoryEntry( 'LDAP://rootDSE' ); $dn=$root.defaultNamingContext.Value; # DC=jp,DC=xxxx,DC=net $entry = New-Object DirectoryServices.DirectoryEntry( "LDAP://$dn" ); $searcher = New-Object DirectoryServices.DirectorySearcher( $entry ); $searcher.Filter = "(&(objectCategory=person)(sAMAccountName=$targetAccountName))"; $user=$searcher.FindOne().GetDirectoryEntry();