_NetConnection_Verb("Подключение по локальной сети", "&Отключить")
;_NetConnection_Verb("Local Area Connection", "Disa&ble")
MsgBox (48, "Сообщение", "Адаптер отключен!")
;_NetConnection_Verb("Local Area Connection", "En&able")
_NetConnection_Verb("Подключение по локальной сети", "&Включить")
MsgBox (64, "Сообщение", "Адаптер включен!")
Func _NetConnection_Verb($sConnectionName, $sVerb)
; Local $sFolderName = "Network Connections"
Local $sFolderName = "Сетевые подключения"
Local $oNetConnections, $oConnection
Local $oShellApp = ObjCreate("Shell.Application")
Local $oControlPanel = $oShellApp.Namespace(3)
For $oFolderItem In $oControlPanel.Items
If $oFolderItem.Name = $sFolderName Then
$oNetConnections = $oFolderItem.GetFolder
ExitLoop
EndIf
Next
If Not(IsObj($oNetConnections)) Then Return SetError(1, 0, False)
For $oFolderitem In $oNetConnections.Items
If StringInStr($oFolderitem.Name, $sConnectionName) Then
$oConnection = $oFolderitem
ExitLoop
EndIf
Next
If Not(IsObj($oConnection)) Then Return SetError(2, 0, False)
$oConnection.InvokeVerb($sVerb)
Sleep(1000)
EndFunc