Results shows only on second run

Hi all,

Like the subject says, when i run the code the first time, i’m not getting results. But if i’ll run from the menu the code again the results will be shown. Why is that?

Here is the code:

    Write-Host -ForegroundColor Yellow "Getting Server list and information..." 
    $ExchServers = Get-ExchangeServer
    foreach ($Server in $ExchServers) {
        Get-Queue -Server $Server
    Write-Host "`n1. Run again `n2. Return to Main Menu"
    $menuresponse = read-host [Please Enter Selection]
    Switch ($menuresponse) {
        "1" {Show-Queue}
        "2" {Main-Menu}

Thanks in advance

Umm… @dady I dunno (being a luddite, noob, and a bit handicapped in the wetware area) but I suspect it has something to do with the environment where you test the code vs. where you invoke it.

As it seems that it produces the proper (to be determined, I suppose) results, perhaps you might adjust your protocol to (as you did) test in the GUI, but verify in situ? jus’ sayin’ (Luddite an’ all that)