Powershell Background if Ping script
<p>I have an old CMD Script which I want to convert into a Powershell Script which runs in the Background, the CMD Script:</p>

<pre><code>@echo off
timeout /t 300 /nobreak
ping -n 1 -i 135 -w 130 192.168.1.250
if errorlevel 1 goto Ende
goto Program
:Program
start "" "C:\Program Files (x86)\XXX\XXX.exe"
Exit

:Ende
Exit
</code></pre>

<p>The Script checks if the Router is pingable, if yes it starts a program.
I have completly zero experience with either CMD or Powershell(see Goto &lt;.&lt;), I tried to do it with google and found some solutions to run it in background but they didn't really work out for me.</p>

<p>The Sleep option should work with start-sleep -s 300, the Ping Check with if (test-connection -computername Server01 -quiet) but im not completly sure how to do an if-statement around the ping.</p>

<p>Greetings</p>