Jump to content

Network activity icon in notification area


Recommended Posts


vbscript to the rescue:

'Enables the Notification Area icon for IP enabled Network Connections, regardless of name.
'Modifies CurrentControlSet001 as observed when modifying via GUI.
'Creates requisite registry entries if missing.
'Reboot required for script completion.

Dim objReg
Dim objWMIService
Dim colNetCards
Dim objNetCard
Dim strNICguid
Const HKLM = &H80000002
strComputer = "." 'Period = local computer
strKeyName = "SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
strKeyName001 = "SYSTEM\CurrentControlSet001\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
dwValue = 1

On Error Resume Next

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNetCards = objWMIService.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objNetCard in colNetCards
strNICguid = objNetCard.SettingID
objReg.SetDWORDValue HKLM, strKeyName & strNICguid & "\Connection", "ShowIcon", dwValue
objReg.SetDWORDValue HKLM, strKeyName001 & strNICguid & "\Connection", "ShowIcon", dwValue
Next

Set objReg = Nothing
Set objWMIService = Nothing

Note that you have to run this from within Windows itself, in a startup script or runonceex - running it during setup has a chance of failing (I've seen it work and I've seen it fail from T-12).

Link to comment
Share on other sites

was gonna say i use a vb script for this, though looks different to yours cluberti

was wriiten by somebody here on the forum and works a treat everytime from runonceex. no i don't remeber who he is though it looks like this

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_NDISWANIP\0000\ClassGUID")

'netIDxx = UID for each member of the Network Connection Class containing specific network adapters
netID01 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0001\NetCfgInstanceID")
netID02 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0002\NetCfgInstanceID")
netID03 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0003\NetCfgInstanceID")
netID04 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0004\NetCfgInstanceID")
netID05 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0005\NetCfgInstanceID")
netID06 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0006\NetCfgInstanceID")
netID07 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0007\NetCfgInstanceID")
netID08 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0008\NetCfgInstanceID")
netID09 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0009\NetCfgInstanceID")
netID10 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0010\NetCfgInstanceID")
netID11 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0011\NetCfgInstanceID")
netID12 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0012\NetCfgInstanceID")
netID13 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0013\NetCfgInstanceID")
netID14 = ws.RegRead(start & "\Control\Class\" & classGUID & "\0014\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

Link to comment
Share on other sites

Of course it can be done with a batch file

@ECHO OFF &SETLOCAL ENABLEEXTENSIONS
SET "KEY=SYSTEM\CurrentControlSet\Control\Network"
SET "SID={4D36E972-E325-11CE-BFC1-08002BE10318}"
FOR /F "TOKENS=*" %%? IN (
'REG QUERY HKLM\%KEY%\%SID% /S^|FINDSTR \\Connection$') DO (
IF ERRORLEVEL 0 (REG QUERY %%?|FIND "Local Area Connection" >NUL 2>&1 &&(
REG ADD "%%?" /V ShowIcon /T REG_DWORD /D 1 /F>NUL)))
ENDLOCAL &GOTO :EOF

Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...