views:

53

answers:

0

I have the Check Point VPN client installed and frequently must toggle the local area connection property (check box) on and off. I have looked at doing this with Power Shell and have found the following.

$colItems = get-wmiobject -query "Select * From Win32_NetworkAdapterConfiguration" | Where-Object {$_.Description -like "Secu"}

foreach ($objItem in $colItems) { write-host "Caption: " $objItem.Caption write-host "Description: " $objItem.Description write-host "DHCPEnabled: " $objItem.DHCPEnabled write-host "Index: " $objItem.Index write-host "InterfaceIndex: " $objItem.InterfaceIndex write-host "IPEnabled: " $objItem.IPEnabled write-host "MACAddress: " $objItem.MACAddress write-host "SettingID: " $objItem.SettingID }

When the VPN is enabled (checked) then the Network Adapter Configuration returns the following.

Caption: [00000028] SecuRemote Miniport Description: SecuRemote Miniport DHCPEnabled: False Index: 28 InterfaceIndex: 30 IPEnabled: False MACAddress: 00:21:70:6F:92:FF SettingID: {A5F7DEF7-9C15-4BD9-A705-7745EDEB7801}

When the VPN client is disabled (un-checked) then the Network Adapter Configuration doesn't include the configuration above, i.e. the output is blank.

Any suggestions on how to toggle this check-box on/off would be appreciated.