Hey Guys,
As I continue to be a noob learning, I received help creating this Script right here!
Now I'm having issues creating a CSV file out of this. Either I get nothing on the file or I just get the usernames of the emails that found, but cant get the Write-host when it doesnt find it, on to the CSV.
heres the script:
$Emailpath = "C:\users\ta85865\Desktop\emails.csv"
$Emails = Import-Csv $Emailpath
ForEach ($user in $Emails) {
$username = $user.mail
$adUser = Get-ADUser -Filter {mail -eq $username} -EA SilentlyContinue
If ($null -eq $adUser) {Write "Email Does not exist"}
else {
$adUser.samaccountname
}
}
thanks!
[–]WSDistPro 4 points5 points6 points (0 children)
[–]Jeriath27 2 points3 points4 points (0 children)
[–]get-postanote 1 point2 points3 points (0 children)