Author Posts

September 8, 2016 at 9:04 am

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 ?

September 8, 2016 at 9:09 am

The Start-Process cmdlet will launch an executable in a separate process unless being told otherwise.

Get-Help Start-Process -Online

September 8, 2016 at 9:14 am

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

September 8, 2016 at 2:52 pm

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..