Catch block does not showing missing users


I am trying to get users from AD by Importing CSV. Earlier I was able to see which users in CSV does not exist in AD by adding user’s fullname variable to catch block and catch block was showing full name of missing users. It stops working somehow. Can you please suggest why.


 $UsersCSV = Import-CSV -path "C:\users\username\Downloads\FinalUserstoMove.csv"

ForEach($User in $UsersCSV){


    $FullName = $User."Display Name"
    $Username = $User."Username"

        Get-ADUser -Identity $Username | Select Name

    Catch { Echo "$Fullname does not exist in AD"}

    Finally { }


The catch block only gets triggered when there’s a terminating error. If the cmdlet you run in the try block does not generate a terminating error by default you have to force it by using the parameter -ErrorAction Stop.

ForEach ($User in $UsersCSV) {
    Try {
        Get-ADUser -Identity $($User.UserName) -ErrorAction Stop | Select-Object -Property Name
    Catch { 
        "'$($User."Display Name")' does not exist in AD" 

Great, Thank you so much @Olaf much appreciated.