none
Do .. While (until) what is wrong in my script? RRS feed

  • Question

  • Hi,

    what is wrong? Exportstatus is "Completed" and "Do" still check, and do not stop.

    $Exportstatus = $null
    Do
    {
       $Exportstatus = (Get-MailboxExportRequest  -Name $displayname).Status
       Write-Host "Export Status: is $Exportstatus" -ForegroundColor Yellow
       Sleep -Seconds 1
    }
    While  ($Exportstatus -eq "Completed")
    
    {
       Write-Host "Export Status: Completed" -ForegroundColor Green
       Read-Host -Prompt "Press any key to continue or CTRL+C to quit"
    
    }
    Just want wait until status complete.

    Tuesday, July 3, 2018 5:00 PM

Answers

All replies

    • Proposed as answer by jrv Tuesday, July 3, 2018 5:29 PM
    • Marked as answer by Denis.Pasternak Tuesday, July 3, 2018 6:20 PM
    Tuesday, July 3, 2018 5:09 PM
  • pick up sticks; if you see a bird while picking up sticks; print bird;

    Please don't do this. It is very annoying. A simple comment is OK but this is totally disruptive to reading the thread.  It is also a very dumb comment.

    \_(ツ)_/

    Tuesday, July 3, 2018 5:31 PM
  • Hm, if use Until - loop stops and nothing happens

    {
       Write-Host "Export Status: Completed" -ForegroundColor Green
       Read-Host -Prompt "Press any key to continue or CTRL+C to quit"
    
    }

    this part not execute

    Tuesday, July 3, 2018 5:39 PM
  • Remove "{}"


    \_(ツ)_/

    Tuesday, July 3, 2018 5:45 PM
  • Hm, if use Until - loop stops and nothing happens

    {
       Write-Host "Export Status: Completed" -ForegroundColor Green
       Read-Host -Prompt "Press any key to continue or CTRL+C to quit"
    
    }

    this part not execute

    :) thanks
    Tuesday, July 3, 2018 6:20 PM