I stumbled upon:
https://autohotkey.com/boards/viewtopic.php?t=1976
https://autohotkey.com/boards/viewtopic.php?f=6&t=51
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
.\root\Microsoft\Windows\RemoteAccess\Client
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 }
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")?
Regards,
drawback