I have two PS scripts (1 main script and 1 as a module).
Main script uses code like:
Write-Host "Press Y to continue"
Execute (ConstructSshSessions)
Where Execute is a function that asks the question to continue and execute the script in the function ConstructSshSessions. If the users does not type a Y then the main scripts skips the function ConstructSshSessions.
Module uses code like:
Function Execute($function)
{
    $response = read-host
    Write-Host "You typed: $response"
    if ($response -eq "Y")
    {
        $function
    }
    Remove-Variable response
}
When I execute the code Excecute (ConstructSshSession) it first runs the script that creates the SSH sessions and then asks the user to continue. So that is clearly not my intention but I do not see the error.
I would like that it asks the users if it may continue and then execute the script that is beeing send as a parameter to the function Execute.
