• It is all about scope. $ExceptionMessage in the function is not the same as the variable in the scope of the script. See this script:

    $stringValue = "global"

    Function F

    {

    $stringValue = "F"

    Write-Host $stringValue # Outputs "F"

    }

    Write-Host $stringValue # Outputs "global"

    F

    Write-Host $stringValue # Outputs "global"

    You could:

    a) Write-Host in the function.

    b) Return the exception (or its text) from the function.

    c) Move the exception handling out of the function (probably not what you want as it would not check each item in your loops).

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!