Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #RequireAdmin
- #include <File.au3>
- MsgBox(16,'',_NetworkConnections('Disable'))
- MsgBox(64,'',_NetworkConnections('Enable'))
- Func _NetworkConnections($action = 'Disable')
- Local $tmpfile = _TempFile(), $data
- If FileExists($tmpfile) Then FileDelete($tmpfile)
- RunWait(@ComSpec & " /c " & 'wmic nic get netconnectionid>'&$tmpfile,'',@SW_HIDE)
- For $i = 2 to _FileCountLines($tmpfile)
- $data = StringStripWS(FileReadLine($tmpfile, $i),3)
- If Not $data = '' Then RunWait(@ComSpec & " /c " & 'netsh interface set interface "'& $data & '" ' &$action,'',@SW_HIDE)
- Next
- FileDelete($tmpfile)
- Return 'Network connections is ' & $action &'d'
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement