I’m trying to locate users, read from a csv file, where the only information I have is the e-mail address as supplied by HR.
I’m trying to optimize the search, because this forest is big, 26 domains and +/- 100K users.
What I’m trying to do is take the input value, search through the each domain, using getqaduser, since it can return PrimarySMTPAddress, and when the user is located, drop out of the search process completely and write some attributes of the object found into another csv file.
I’ve tried several variations of while and until functions and I can’t get it right…
an example is :
Get-PSSnapin -Registered | Add-PSSnapin
$searchaddress=Read-host(“Enter the e-mail address you are looking for”)
if($inputobject.PrimarySMTPAddress -eq $searchaddress)
Write-Host(“User $searchaddress found in domain $addom”)
foreach($addom in $addomlist)
Write-host(“Searching Domain $addom”)
while($userfound -eq $false)
get-qaduser -SizeLimit 0 |
I know I’m being stupid and any help would be greatly appreciated.
I could use the Exchange CMDLETs and run get-recipient but I can’t guarantee that the eventual users will have those tools to hand so I’m trying to keep it as generic as possible…
Any help would be greatly appreciated.