Verify Contact Record from a File with Get-Content
I have a list users last names in text file. I need to verify that they have a contact record in Exchange 2007. I tried this command, but I am receiving an error.get-contact -resultsize unlimited|where {$_.displayname -match (get-content c:\scripts\ps\lastname1.txt)}|select displayname, windowsemailaddressI receive no results, even though I know some of the records exist, so I know I have an error somewhere.Any Idea?Thanks in Advance!
March 16th, 2010 8:55pm

Does this work?get-content c:\scripts\ps\lastname1.txt |% { $found = get-contact -resultsize unlimited |? {$_.lastname -eq $_} if ($found){$found | ft displayname,windowsemailaddress} else {write-host "$($_) was not found."}}
Free Windows Admin Tool Kit Click here and download it now
March 16th, 2010 9:23pm

Works great, Thank You!I did have to set the $warningpreference = "silentlycontinue" due to some invalid SMTP addresses.
March 17th, 2010 3:29pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics