WMI - PS_VpnConnection alternative for Windows 7?

Get help with using AutoHotkey and its commands and hotkeys
Posts: 34
Joined: 11 Aug 2016, 11:31

WMI - PS_VpnConnection alternative for Windows 7?

11 Aug 2016, 11:55


I stumbled upon:

to get some examples how to use the COM interface for WMI calls.

I have a VPN connection I want to get some values from. Under Windows 8+ the namespace
exists and makes this task easy:

Code: Select all

	query := "SELECT * FROM PS_VpnConnection WHERE Name = " "'" rasConnection "'"
	for objItem in ComObjGet("winmgmts:\\.\root\Microsoft\Windows\RemoteAccess\Client").ExecQuery(query)
		return, % { "ServerAddress" : objItem.ServerAddress, "ConnectionStatus" : objItem.ConnectionStatus, "TunnelType" : objItem.TunnelType }
Where "rasConnection" is the name of my vpn adapter in "Network connections".

I do not necessarily need the TunnelType atm but the ConnectionStatus and the ServerAdress.

The problem is, under Window 7 this namespace doesn't exist (it was added with 8+).

Does anyone know how to get these properties from a different namespace while having only the name of the name of the vpn adapter (e.g.: "Work VPN")?


Return to “Ask For Help”

Who is online

Users browsing this forum: Dinarid, JoeWinograd, manehscripts, mikeyww, ToJaRedi and 59 guests