VPN Connection Active/Inactive


I wanted a script to check the VPN connection(Pulse Secure) active or inactive . Based on the VPN status we need to deploy a upgraded version of VPN application(Pulse Secure).
This is how script should work :

1. Check in VPN is connected or not 

2. if connected exit the upgrade deployment

3. If not connected then got with the deployment

This has to be done in Batch Script . Is it possible?any suggestions ?

3 Comments   [ + ] Show comments
  • Batch??!!?? Good luck... - rileyz 5 years ago
  • Can you check their IP? Either what's reported in KACE or in ipconfig? - ondrar 5 years ago
  • either grep for the IP or use something like powershell to get the $_.state and $_.name of a specific network adapter and check if it's enabled. If you only have batch files...good luck. - isudothings 5 years ago

Answers (2)

Posted by: KVB 4 years ago
Senior White Belt

I don't know why this year old post was shown to me now via email, but I could have given some useful info then.

I'm a Powershell guy these days so take what you can from it, the path is valid.

Returns '1' if Pulse is connected and '0' if not.

(Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Pulse Secure\Pulse\State' -EA SilentlyContinue).VpnTunnelEstablished 

I don't like using that key as I'm not certain it updates quickly and reliably. Instead I often just check for the process

Get-Process -name Pulse -ea SilentlyContinue
Don't use Pulse.exe, PS doesn't like the extension unless you're starting a process.

Posted by: SMal.tmcc 5 years ago
Red Belt

in the batch file you are better off using a task kill to stop the program first.

I am using iexplore.exe in the example since I do not know the name of the pulse connect exe

tasklist | find /i "iexplore.exe" && taskkill /im iexplore.exe /F

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ