A do-while error powershell script

Home Forums Scripting PowerShell A do-while error powershell script

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    XtaZee
    Member
    #164005

    Hi,

    need you help here

    I have a Script in Powershell that runs from command line, I would like to run it in a Do While loop until error code is 0

    Code:
    powershell.exe -Command “& {$host.UI.RawUI.WindowTitle=’TASK: RunningAScript’; Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force; \blablaScriptsRunningAscript.ps1 -Daily -maxCount:5000 -Automation; $ret=$LASTEXITCODE; exit $ret }” -WindowStyle Minimized -NonInteractive -ExecutionPolicy Unrestricted

    how do I add the Do-While loop into this command so it will run again and again until the error code will be 0 (which means the script didn’t fail)

    Thanks !

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.