Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


atabrk

[REQ] Show icon in notification area when connected

Recommended Posts

I want "Show icon in notification area when connected" option in connection properties to be checked as default for every connection. İs there a registery tweak for this? So i can add it to windows installation and see the connection icon on notification area.

Share this post


Link to post
Share on other sites

Got this here at msfn but buried somewhere so won't even look

can add to your runoncex to execute it. Works for me

LANIconShow.cmd

REM @ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
FOR /F "TOKENS=1 DELIMS= " %%A IN ('REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}') DO (
SET TEMP1=%%A
SET TEMP2=!TEMP1:~99,38!
SET TEMP3=!TEMP2:~-1!
IF "!TEMP3!"=="}" (
IF NOT "!TEMP2!"=="{4D36E972-E325-11CE-BFC1-08002BE10318}" (
SET REGSTR1=HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\!TEMP2!\Connection
SET REGSTR2=HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\!TEMP2!
REG ADD !REGSTR1! /v ShowIcon /t REG_DWORD /d 1 /f
REG ADD !REGSTR2! /v IPAutoconfigurationEnabled /t REG_DWORD /d 0 /f
)
)
)
EXIT

Share this post


Link to post
Share on other sites

It looks a little over-complicated to me! :huh:

Here's a single line batch file solution

@FOR /F "DELIMS=" %%? IN ('REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} /S^|FINDSTR \\Connection$') DO @REG ADD "%%?" /V ShowIcon /T REG_DWORD /D 1 /F>NUL

Share this post


Link to post
Share on other sites

Think I got you beat!!! ;)

On Error Resume Next

set ws = WScript.CreateObject("WScript.Shell")

start = "HKLM\SYSTEM\CurrentControlSet"

'classGUID = GUID for all Network Connection Class
classGUID = ws.RegRead(start & "\Enum\Root\MS_NDISWANIP000\ClassGUID")

'netIDxx = UID for each member of the Network Connection Class containing specific network adapters
netID01 = ws.RegRead(start & "\Control\Class\" & classGUID & "001\NetCfgInstanceID")
netID02 = ws.RegRead(start & "\Control\Class\" & classGUID & "002\NetCfgInstanceID")
netID03 = ws.RegRead(start & "\Control\Class\" & classGUID & "003\NetCfgInstanceID")
netID04 = ws.RegRead(start & "\Control\Class\" & classGUID & "004\NetCfgInstanceID")
netID05 = ws.RegRead(start & "\Control\Class\" & classGUID & "005\NetCfgInstanceID")
netID06 = ws.RegRead(start & "\Control\Class\" & classGUID & "006\NetCfgInstanceID")
netID07 = ws.RegRead(start & "\Control\Class\" & classGUID & "007\NetCfgInstanceID")
netID08 = ws.RegRead(start & "\Control\Class\" & classGUID & "008\NetCfgInstanceID")
netID09 = ws.RegRead(start & "\Control\Class\" & classGUID & "009\NetCfgInstanceID")
netID10 = ws.RegRead(start & "\Control\Class\" & classGUID & "010\NetCfgInstanceID")
netID11 = ws.RegRead(start & "\Control\Class\" & classGUID & "011\NetCfgInstanceID")
netID12 = ws.RegRead(start & "\Control\Class\" & classGUID & "012\NetCfgInstanceID")
netID13 = ws.RegRead(start & "\Control\Class\" & classGUID & "013\NetCfgInstanceID")
netID14 = ws.RegRead(start & "\Control\Class\" & classGUID & "014\NetCfgInstanceID")

' setIcon recieves location of current network connections and also flag (1) to turn on showIcons
setIcon start & "\Control\Network\" & classGUID & "\" & netID01 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID02 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID03 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID04 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID05 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID06 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID07 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID08 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID09 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID10 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID11 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID12 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID13 & "\Connection\", 1
setIcon start & "\Control\Network\" & classGUID & "\" & netID14 & "\Connection\", 1




'MsgBox "Show icon in Notification Area when connected is set.", 4096,"Finished"


'********************************************************
' Subroutine setIcon(nicID as String, flag as Binary)
' strName = Registry Value of "Name" in Current nicID. Network connections with Icons also contain a "Name" Registry setting
' Will not effect 1394 Connection through string comparison with strName
' flag is used to turn to set ShowIcon registry setting

Sub setIcon(nicID,flag)
strName = ws.RegRead( nicID & "Name")
If strName = "" Then
else
if InStr(strName, "1394") = 0 then
' MsgBox strName
ws.RegWrite nicID & "ShowIcon", flag, "REG_DWORD"
end if
end if
End Sub

Edited by war59312

Share this post


Link to post
Share on other sites

This is my AutoIt script:

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.12.1
Language: English
Platform: Windows XP
Author: artbio

Script Function:
Show icon in notification area when connected.

#ce ----------------------------------------------------------------------------

#NoTrayIcon

#include <Misc.au3>

_Singleton("Network Icon AutoIt v3 Script 1.0", 0); It's already running

Dim Const $sKey = "HKLM\SYSTEM\CurrentControlSet\Control\Network"
Dim $k
While 1
$k += 1
$sSubKey0 = RegEnumKey($sKey, $k)
If @error Then ExitLoop
$sDefault = RegRead($sKey & "\" & $sSubKey0, "")
$sClass = RegRead($sKey & "\" & $sSubKey0, "Class")
If $sDefault = "Network Adapters" And $sClass = "Net" Then ExitLoop
WEnd
$k = 0
While 1
$k += 1
$sSubKey1 = RegEnumKey($sKey & "\" & $sSubKey0, $k)
If @error Then ExitLoop
If RegRead($sKey & "\" & $sSubKey0 & "\" & $sSubKey1 & "\Connection", "Name") = "Local Area Connection" Then ExitLoop
WEnd
If Not @error Then RegWrite($sKey & "\" & $sSubKey0 & "\" & $sSubKey1 & "\Connection", "ShowIcon", "REG_DWORD", 1)

Exit

Regards.

Share this post


Link to post
Share on other sites

Here is the other AutoIt function I did for the same purpose:

#include-once

; #FUNCTION# ====================================================================================================
================
;
; Name...........: _Network_SetIcon
; Description ...: Shows or hides the network icon in notification area when connected.
; Syntax.........: _Network_SetIcon($sNetConnectionID [, $iFlag, $sComputerName])
; Parameters ....: $sNetConnectionID - Name of the network connection.
; $iFlag - [Optional] A flag indicating the behaviour of the network icon:
; 0 - Icon in notification area when connected remains hidden.
; 1 - Icon in notification area when connected is shown.
; Default is "1".
; $sComputerName - [Optional] Computer name.
; The local computer is default.
; Return values .: Success - Returns 1
; Failure - Returns 0 and sets @error:
; Author ........: artbio
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ====================================================================================================
===========================

Func _Network_SetIcon($sNetConnectionID, $iFlag = 1, $sComputerName = @ComputerName)
Local Const $sKey = "\\" & $sComputerName & "\HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
Local $objWMIService, $colAdapters, $colAdaptersConfig, $iRet
$objWMIService = ObjGet("winmgmts:{ImpersonationLevel=impersonate}!\\" & $sComputerName & "\root\CIMV2")
$colAdapters = $objWMIService.ExecQuery('Select * from Win32_NetworkAdapter Where NetConnectionID = "' & $sNetConnectionID & '"')
For $objAdapter In $colAdapters
$colAdaptersConfig = $objWMIService.ExecQuery('Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True And MACAddress = "' & $objAdapter.MACAddress & '"')
For $objAdapterConfig In $colAdaptersConfig
$iRet = RegWrite($sKey & $objAdapterConfig.SettingID & "\Connection", "ShowIcon", "REG_DWORD", $iFlag)
Next
Next
Return SetError($iRet = 0, 0, $iRet)
EndFunc;==> _Network_SetIcon

Regards.

Share this post


Link to post
Share on other sites

This is an improved version:

#include-once

; #FUNCTION# ====================================================================================================
==================================================================
;
; Name...........: _Network_SetIcon
; Description ...: Shows or hides the network icon in notification area when connected.
; Syntax.........: _Network_SetIcon($sNetConnectionID [, $iFlag, $sComputerName])
; Parameters ....: $sNetConnectionID - Name of the network connection.
; $iFlag - [Optional] A flag indicating the behaviour of the network icon:
; 0 - Icon in notification area when connected remains hidden.
; 1 - Icon in notification area when connected is shown.
; Default is "1".
; $sComputerName - [Optional] Computer name.
; The local computer is default.
; Return values .: Success - Returns 1
; Failure - Returns 0 and sets @error:
; Author ........: artbio
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ====================================================================================================
=============================================================================

Func _Network_SetIcon($sNetConnectionID, $iFlag = 1, $sComputerName = @ComputerName)
Local Const $sRootKey = "\\" & $sComputerName & "\HKLM\SYSTEM\CurrentControlSet\"
Local $objWMIService, $colWAN, $sClassGUID, $colAdapters, $colConfig, $iRet = 0
$objWMIService = ObjGet("winmgmts:{ImpersonationLevel=impersonate}!\\" & $sComputerName & "\root\CIMV2")
$colWAN = $objWMIService.ExecQuery('Select * from Win32_NetworkAdapter Where Name = "WAN Miniport (IP)"')
For $objWAN In $colWAN
$sClassGUID = RegRead($sRootKey & "Enum\" & $objWAN.PNPDeviceID, "ClassGUID")
If Not @error Then
$colAdapters = $objWMIService.ExecQuery('Select * from Win32_NetworkAdapter Where NetConnectionID = "' & $sNetConnectionID & '"')
For $objAdapter In $colAdapters
$colConfig = $objWMIService.ExecQuery('Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True And MACAddress = "' & $objAdapter.MACAddress & '"')
For $objConfig In $colConfig
$iRet = RegWrite($sRootKey & "Control\Network\" & $sClassGUID & "\" & $objConfig.SettingID & "\Connection", "ShowIcon", "REG_DWORD", $iFlag)
Next
Next
EndIf
Next
Return SetError($iRet = 0, 0, $iRet)
EndFunc;==> _Network_SetIcon

Share this post


Link to post
Share on other sites
It looks a little over-complicated to me! :huh:

Here's a single line batch file solution

@FOR /F "DELIMS=" %%? IN ('REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} /S^|FINDSTR \\Connection$') DO @REG ADD "%%?" /V ShowIcon /T REG_DWORD /D 1 /F>NUL

thank u so much , worked great with me and also very simple :thumbup

Edited by Oxygen

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...