Sign in to follow this  
Followers 0
friendfox

How to DISABLE network CARD?

3 posts in this topic

How to DISABLE or ENABLE network CARD?

Share this post


Link to post
Share on other sites



How to DISABLE or ENABLE network CARD?

search the forum: +disable +network +card. There are several proposed solutions.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

$ret = LanToggle('Local Area Connection')

Select
 Case $ret = 1
  MsgBox(0, '', 'Done!')
 Case Else
  MsgBox(0, '', '"Lan Area Connection" is not available')
EndSelect


Func LanToggle($lanconnection)
 $status = ''
 $status_ = ''
 $objwmiservice = ObjGet('winmgmts:\\localhost\root\CIMV2')
 $colitems = $objWMIService.ExecQuery ('SELECT * FROM Win32_NetworkAdapter', 'WQL', 0x10 + 0x20)
 If IsObj($colitems) Then
  For $objitem In $colitems
   If String($objitem.netconnectionid) = $lanconnection Then
    $status = Not (Not ($objitem.netconnectionstatus))
    ExitLoop
   EndIf
  Next
 EndIf
 $shellapp = ObjCreate('shell.application')
 $ocontrolpanel = $shellApp.Namespace (3)
 For $folderitem In $ocontrolpanel.items
  If $folderitem.name = 'Network Connections' Then
   For $folderitem In $folderitem.getfolder.items
    If StringLower($folderitem.name) = StringLower($lanconnection) Then
     For $verb In $folderitem.verbs
      If $verb.name = 'En&able' Or $verb.name = 'Disa&ble' Then
       $verb.doit
       $exitlantoggle = 0
       While $exitlantoggle = 0
        Sleep(1)
        $colitems = $objWMIService.ExecQuery ('SELECT * FROM Win32_NetworkAdapter', 'WQL', 0x10 + 0x20)
        If IsObj($colitems) Then
         For $objitem In $colitems
          If String($objitem.netconnectionid) = $lanconnection Then $status_ = Not (Not ($objitem.netconnectionstatus))
          If $status = Not ($status_) Then
           $exitlantoggle = 1
           ExitLoop
          EndIf
         Next
        EndIf
       WEnd
       Return 1
      EndIf
     Next
    EndIf
   Next
  EndIf
 Next
 Return 0
EndFunc   ;==>LanToggle

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0