I am trying to fetch the user details via below script, When I run it without exporting to csv, I see there are some users id which cant be found although not the email id's I can see, so tried to use try catch loop, but still it only shows not found not the email address. Could you please advise ?
I think Tim's possibility is valid. Gut your function momentarily, and just put Write-Output $U. This will allow you to first determine that you iterating thought the file's contents properly. It's after this, that you start adding the try-catch blocks and Get-ADUser cmdlets.
Another concern, for me at least, is your calculated property — that's busted. One, you need to reference the property in the Expression portion with $_, or in PowerShell 3.0 and greater, as $PSItem. ...E=$_.co... Second, and quite important, is that there isn't a "co" property. Run this:
Get-ADUser -Identity auser -Properties *
and look though the properties (replacing auser with a valid SamAccountName). You'll see that there's no property called "co." Replace it with something that actually exists. Did you mean Country? If so, your calculated property would be: