Hi
I need something that will start a process then wait until ping is true
$ ‘C:\tmp\myVPN.exe’
do {$ping=test-connection -computer “myserver.domain.local” -quiet} until($ping)
#then do more stuff after above ping returns true.
but it halts after starting the software since the vpn doesn’t shut down (obviously)
how can I start the vpn in a seperate process? or whatever I need to do ?
The Start-Process cmdlet will launch an executable in a separate process unless being told otherwise.
Get-Help Start-Process -Online
Daniel is right. Use Start-Process here like this:
$process = Start-Process -FilePath 'C:\tmp\myVPN.exe' -PassThru
I’m putting the returned object in a variable, so that you can use it to do some checks on. Like this:
$process | Get-Process
Thx guys… I actually did something else… I added ‘-asJob’ which seems to achieve the same thing… but I will definetely change to the above…