Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

How to Disable "Hamachi Network Interface"?


  • Please log in to reply
5 replies to this topic

#1 iXX

iXX

    Seeker

  • Active Members
  • 38 posts

Posted 20 October 2010 - 08:04 AM

HI! ;)

I need script for Disable "Hamachi Network Interface".
Script must work even if there is no icon for this network in SysTray.
Thanks for help...







#2 UEZ

UEZ

    Never say never

  • MVPs
  • 4,987 posts

Posted 20 October 2010 - 10:44 AM

Might help: http://www.autoitscript.com/forum/index.php?showtopic=118205

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#3 iXX

iXX

    Seeker

  • Active Members
  • 38 posts

Posted 20 October 2010 - 04:08 PM

Might help: http://www.autoitscript.com/forum/index.php?showtopic=118205

Br,
UEZ

Because that scripts don't work for me (I don't know how to edit them for my Czech OS language), I have solved this by very, very jerkily way:

1. I open the Network Connection folder.
2. Right click to "Hamachi" interface, drag it to my QuickLaunch panel and make shortcut there.
3. For disabling Hamachi adapter, I use this: ;)


$MousePos = MouseGetPos()  ; Save actual mouse position MouseClick("right", 116, 754, 1, 0)  ; Click to QiuckLaunch Hamachi shortcut to show menu Sleep(50) Send("{DOWN}")  ; Select first from top item of menu (Disable) Sleep(50) Send("{ENTER}")  ; Disable! Sleep(50) MouseMove($MousePos[0], $MousePos[1], 0)  ; Return mouse to original location


I know, this is maybe the badest solution ever, I hope someone will translate proper scripts to my os language... :)

Edited by iXX, 22 October 2010 - 12:17 PM.


#4 iXX

iXX

    Seeker

  • Active Members
  • 38 posts

Posted 22 October 2010 - 12:15 PM

I need a better script to disable Hamachi Network Interface. That one above is too absurd... ;)

I am trying scripts from: http://www.autoitscript.com/forum/index.php?showtopic=118205
But I dont know how to modify them EXACTLY.

Here is what I think is needed:

My OS is: WinXP SP3 Czech
Folder "Network Connection" = "Síťová připojení"
Name of network adapter: "Hamachi"
Description of network adapter: "Hamachi Network Interface"
"En&able" = "&Povolit"
"Disa&ble" = "&Zakázat"
But I don't know how to edit this line:
    Case StringInStr("0409,0809,0c09,1009,1409,1809,1c09,2009,2409,2809,2c09,3009,3409", @OSLang) ; English (United States)
Where can I get this numbers for Czech language?


So, how to edit this one?:

AutoIt         
#RequireAdmin Func AdapterKill($AdaptDescription, $ConnectionName, $bEnable = false)     ;$AdaptDescription = "' '"  ;for Vista/Win7 Actual Adapter Name must be single quoted inside double-quotes     ;$ConnectionName = " " ;for PreVista Connection Name in Net Connections         if @OSType<>"WIN32_NT" then         SetError(1)     endif     if @OSVersion="WIN_2000" then         $strFolderName = "Network and Dial-up Connections"         PreVistaDisable($ConnectionName,$strFolderName,$bEnable)         Return 0     elseif StringInStr(@OSVersion, "WIN_XP") then         $strFolderName = "Network Connections"         PreVistaDisable($ConnectionName,$strFolderName,$bEnable)         Return 0     else         VistaDisable($AdaptDescription,$bEnable)         Return 0     endif EndFunc Func VistaDisable($Adapter, $bEnable = false)     $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")     If $objWMIService.ExecQuery("SELECT Description FROM Win32_NetworkAdapter WHERE NetEnabled = True AND Description = " & $Adapter).Count > 0 Then         $colItems = $objWMIService.ExecQuery("SELECT Description FROM Win32_NetworkAdapter WHERE NetEnabled = True AND Description = " & $Adapter)         If IsObj($colItems) Then             For $objItem In $colItems                 If $bEnable = False Then                     $objItem.Disable()                 Else                     $objItem.Enable()                 EndIf                                 Next             Return 0         EndIf               EndIf EndFunc Func PreVistaDisable($oLanConnection,$strFolderName, $bEnable = false)     ;$bEnable = false             ; Change this to 'false' to DISABLE the network adapter     Select         Case StringInStr("0409,0809,0c09,1009,1409,1809,1c09,2009, 2409,2809,2c09,3009,3409", @OSLang) ; English (United States)            $strEnableVerb  = "En&able"            $strDisableVerb = "Disa&ble"     ; Add here the correct Verbs for your Operating System Language     EndSelect     ;Virtual folder containing icons for the Control Panel applications. (value = 3)     Const $ssfCONTROLS = 3     $ShellApp = ObjCreate("Shell.Application")     $oControlPanel = $shellApp.Namespace($ssfCONTROLS)     ; Find 'Network connections' control panel item     $oNetConnections=""     For $FolderItem in $oControlPanel.Items         If $FolderItem.Name = $strFolderName then             $oNetConnections = $FolderItem.GetFolder             Exitloop         Endif     Next               If not IsObj($oNetConnections) Then         SetError(1)     EndIf                 For $FolderItem In $oNetConnections.Items         If StringLower($FolderItem.Name) = StringLower($oLanConnection) Then             $oLanConnection = $FolderItem             Exitloop         EndIf     Next     If not IsObj($oLanConnection) Then         SetError(1)     EndIf     $oEnableVerb=""     $oDisableVerb=""     For $Verb In $oLanConnection.Verbs      If $Verb.Name = $strEnableVerb Then        $oEnableVerb = $Verb      EndIf      If $Verb.Name = $strDisableVerb Then        $oDisableVerb = $Verb      EndIf     Next     If $bEnable then      If IsObj($oEnableVerb) Then $oEnableVerb.DoIt  ; Enable network card     Endif     If not $bEnable then      If IsObj($oDisableVerb) Then $oDisableVerb.DoIt; Disable network card     EndIf     Sleep(1000) EndFunc


#5 iXX

iXX

    Seeker

  • Active Members
  • 38 posts

Posted 24 October 2010 - 08:11 PM

SOLVED!

So, if anyone need script to DISABLE Hamachi Network Interface on CZECH WinXP (and maybe others windows versions), use this modificated one:

AutoIt         
#RequireAdmin Func AdapterKill($AdaptDescription, $ConnectionName, $bEnable = false)     ;$AdaptDescription = "' '"  ;for Vista/Win7 Actual Adapter Name must be single quoted inside double-quotes     ;$ConnectionName = " " ;for PreVista Connection Name in Net Connections         if @OSType<>"WIN32_NT" then         SetError(1)     endif     if @OSVersion="WIN_2000" then         $strFolderName = "Network and Dial-up Connections"         PreVistaDisable($ConnectionName,$strFolderName,$bEnable)         Return 0     elseif StringInStr(@OSVersion, "WIN_XP") then         $strFolderName = "Síťová připojení"         PreVistaDisable($ConnectionName,$strFolderName,$bEnable)         Return 0     else         VistaDisable($AdaptDescription,$bEnable)         Return 0     endif EndFunc Func VistaDisable($Adapter, $bEnable = false)     $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")     If $objWMIService.ExecQuery("SELECT Description FROM Win32_NetworkAdapter WHERE NetEnabled = True AND Description = " & $Adapter).Count > 0 Then         $colItems = $objWMIService.ExecQuery("SELECT Description FROM Win32_NetworkAdapter WHERE NetEnabled = True AND Description = " & $Adapter)         If IsObj($colItems) Then             For $objItem In $colItems                 If $bEnable = False Then                     $objItem.Disable()                 Else                     $objItem.Enable()                 EndIf                                 Next             Return 0         EndIf               EndIf EndFunc Func PreVistaDisable($oLanConnection,$strFolderName, $bEnable = false)     ;$bEnable = false             ; Change this to 'false' to DISABLE the network adapter     Select         Case StringInStr("0405,0409,0809,0c09,1009,1409,1809,1c09,2009, 2409,2809,2c09,3009,3409", @OSLang) ; English (United States)            $strEnableVerb  = "&Povolit"            $strDisableVerb = "&Zakázat"     ; Add here the correct Verbs for your Operating System Language     EndSelect     ;Virtual folder containing icons for the Control Panel applications. (value = 3)     Const $ssfCONTROLS = 3     $ShellApp = ObjCreate("Shell.Application")     $oControlPanel = $shellApp.Namespace($ssfCONTROLS)     ; Find 'Network connections' control panel item     $oNetConnections=""     For $FolderItem in $oControlPanel.Items         If $FolderItem.Name = $strFolderName then             $oNetConnections = $FolderItem.GetFolder             Exitloop         Endif     Next               If not IsObj($oNetConnections) Then         SetError(1)     EndIf                 For $FolderItem In $oNetConnections.Items         If StringLower($FolderItem.Name) = StringLower($oLanConnection) Then             $oLanConnection = $FolderItem             Exitloop         EndIf     Next     If not IsObj($oLanConnection) Then         SetError(1)     EndIf     $oEnableVerb=""     $oDisableVerb=""     For $Verb In $oLanConnection.Verbs      If $Verb.Name = $strEnableVerb Then        $oEnableVerb = $Verb      EndIf      If $Verb.Name = $strDisableVerb Then        $oDisableVerb = $Verb      EndIf     Next     If $bEnable then      If IsObj($oEnableVerb) Then $oEnableVerb.DoIt  ; Enable network card     Endif     If not $bEnable then      If IsObj($oDisableVerb) Then $oDisableVerb.DoIt; Disable network card     EndIf     Sleep(1000) EndFunc   AdapterKill ("", "Hamachi")


#6 UEZ

UEZ

    Never say never

  • MVPs
  • 4,987 posts

Posted 24 October 2010 - 09:01 PM

;)

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users