Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Start/Stop VPN based on Network Traffic of App X

If you have a question or need help, this is the place to be.
Post Reply
mikeparkie
Posts: 17
Joined: Wed Jul 30, 2014 9:53 am

Start/Stop VPN based on Network Traffic of App X

Post by mikeparkie »

Hi there,

I've been using EG for some time (current version 0.4.1.r1694) but for the life of me I cannot figure something out. As the title says I would like to start my VPN when a certain program is running, when the network traffic stops i.e. download complete, I would like it to stop the VPN. I have the VPN tasks in place and they were perfectly, I just need help with the networking monitoring. Using Windows 10 x64.

Thanks in-advance.
mikeparkie
Posts: 17
Joined: Wed Jul 30, 2014 9:53 am

Re: Start/Stop VPN based on Network Traffic of App X

Post by mikeparkie »

Anyone?
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Start/Stop VPN based on Network Traffic of App X

Post by kgschlosser »

yeah i can help ya with that, you are going to have to run a CLI command to start the vpn up

but there is way more specific information i need.


what exactly do you need to monitor??

is it a program running or something on the network???

are you trying to run the VPN that is built into windows??? or turn it on in a router??
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Start/Stop VPN based on Network Traffic of App X

Post by kgschlosser »

you would need to have EG run this command
to start the VPN

C:\Windows\System32\rasdial.exe "VPN" "username" "password"


and this command to stop it

C:\Windows\System32\rasdial.exe "VPN" "username" "password" /disconnect

as far as the program running i would say Process Watcher is the way to go it's in the eg plugins

that will post an event when a program runs and closes

so you would create a macro and put the event in it for the program that launches that you want to watch

so here is the xml for the launching of the commandline thing (haven't tested it but it gives you the idea)

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1700">
    <Macro Name="Start Program" Expanded="True">
        <Action>
            System.Execute(u'rasdial.exe ', u'"VPN" "username" "password" /disconnect ', 3, False, 4, u'C:\\Windows\\System32\\', False, False, u'', True, True, False)
        </Action>
    </Macro>
</EventGhost>
it will be something similiar to that.

if you copy the code and then right click in your eg tree and select paste it will make the macro

the network thing i am not sure what you are exactly trying to do with that but if the program closes after it is done downloading then you are good because that will generate a event
If you like the work I have been doing then feel free to Image
Post Reply