LDAP Filter用法

 

#根据Pager过滤域用户
$pagers = gc D:\Operations\tmp\u.txt
foreach ($p in $pagers)
{
$user = Get-ADUser -Filter "pager -eq '$($p)'" -Properties pager -searchbase ",ou=yy,dc=ux,dc=yy,dc=com" 
if ($user -ne $null)
{$user.pager + "," + $user.SamAccountName + "," + $user.UserPrincipalName |Out-File D:\Operations\tmp\ctz2.csv -Append}
else {$p|Out-File D:\\tmp\ctz2.csv -Append}
}

 

#查找非禁用账号&非密码永不过期&上次修改密码时间早于2018年3月4日的用户
$d = get-date "2018/3/4 14:12:24"
$ys = Get-ADUser -Filter 'Enabled -eq "true" -and PasswordNeverExpires -eq "false" -and pwdLastSet -lt $d' -Properties PasswordLastSet -SearchBase "OU=yy,dc=ux,dc=xx,dc=com"

 

你可能感兴趣的:(LDAP Filter用法)