Jump to content
Sign in to follow this  

Get VPN status via WMI on Vista

Recommended Posts


On XP, we can get the IP address for an VPN connections like below:

strComputer = "." 
Set objWMIService = GetObject("winmgmts:" _  
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")  
Set IPConfigSet = objWMIService.ExecQuery _  
    ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")  
For Each IPConfig in IPConfigSet  
    If Not IsNull(IPConfig.IPAddress) Then   
        For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)  
            WScript.Echo IPConfig.IPAddress(i)  
    End If  

But on Vista, the VPN connection is not in this Win32_NetworkAdapterConfiguration class, where it has gone??

One way ist netsh interface ip show address %PPTPname% but ist there a way via wmi ?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this