$users=Get-Content H:\powershell\erp\NOERP.txt $out = 0 foreach($user in $users) { $out += (Get-ADUser -Filter * -SearchBase $user ).count } $out
txt like this
i will get this error,But I can execute by one line 。。。。。Get aduser: the distinguished name provided must belong to one of the following partitions