In the Internet, there is a number of examples of how to set an individual NIC to show icon in notification area, but you cannot find one if you want to set ALL the NICs by default. This is a required for my work and, hence, modified some of the scripts on the net and using WMI registry class to do the task.
You can download the VBS (please rename doc to vbs) script here
The WriteToLog() is my own function (show you some other days), you can replace it with WScript.echo.
Also note, I stopped indent after some levels so that it does not wrap around too much
‘==========================================
Sub SetShowIconValue
‘==========================================Const HKLM = &H80000002
Dim ServerName
Dim objRegDim CtrlNetworkKeyPath
Dim arrAdapterGUIDs, AdapterGUID
Dim AdapterGUIDConnKeyPath
Dim AdapterNameValue
Dim AdapterNameStringValue
Dim ShowIconDWORDValueServerName = “.”
‘Don’t want any errors here to kill the program
On error resume nextSet objReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & _
ServerName & “\root\default:StdRegProv”)‘This path is fixed in Windows
CtrlNetworkKeyPath = “SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}”
‘grab all the subkeys, i.e. the Adapter GUIDs
objReg.EnumKey HKLM, CtrlNetworkKeyPath, arrAdapterGUIDs
for each AdapterGUID in arrAdapterGUIDs
if InStr(AdapterGUID, “{“) > 0 then ‘look for keys that looks like a GUID
AdapterGUIDConnKeyPath = CtrlNetworkKeyPath & “\” & AdapterGUID & “\Connection”
AdapterNameStringValue = “”
objReg.GetStringValue
HKLM,AdapterGUIDConnKeyPath,”Name”,AdapterNameStringValue
if AdapterNameStringValue <> “” then
WriteToLog “Looking at registry path: ” & AdapterGUIDConnKeyPath
WriteToLog “Network Name: ” & AdapterNameStringValue‘Just set all NICs regardless of their status, no harm done
objReg.SetDWORDValue HKLM,AdapterGUIDConnKeyPath,”ShowIcon”,1
if Err.Number = 0 then
WriteToLog “Show Icon value is set to: 1″else
WriteToLog “Error ” & CStr(Err.Number) & ” while trying to check ShowIcon value, ” & Err.Description
end ifelse
WriteToLog “Cannot get name for network adapter GUID:” & AdapterGUIDConnKeyPath
end if
end if
next
On error goto 0
End Sub