school1282 Posted June 8, 2006 Posted June 8, 2006 Hello,How can I set icon of network connection in unattended setup (winnt.sif or ...) ?ThanksShabbyttt.bmp
cluberti Posted June 8, 2006 Posted June 8, 2006 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 objRegDim objWMIServiceDim colNetCardsDim objNetCardDim strNICguidConst HKLM = &H80000002strComputer = "." 'Period = local computerstrKeyName = "SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\"strKeyName001 = "SYSTEM\CurrentControlSet001\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\"dwValue = 1On Error Resume NextSet 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", dwValueNextSet objReg = NothingSet objWMIService = NothingNote 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).
oioldman Posted June 8, 2006 Posted June 8, 2006 was gonna say i use a vb script for this, though looks different to yours clubertiwas 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 thisOn Error Resume Nextset ws = WScript.CreateObject("WScript.Shell")start = "HKLM\SYSTEM\CurrentControlSet"'classGUID = GUID for all Network Connection ClassclassGUID = ws.RegRead(start & "\Enum\Root\MS_NDISWANIP\0000\ClassGUID")'netIDxx = UID for each member of the Network Connection Class containing specific network adaptersnetID01 = 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 showIconssetIcon start & "\Control\Network\" & classGUID & "\" & netID01 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID02 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID03 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID04 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID05 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID06 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID07 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID08 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID09 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID10 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID11 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID12 & "\Connection\", 1setIcon start & "\Control\Network\" & classGUID & "\" & netID13 & "\Connection\", 1setIcon 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 settingSub setIcon(nicID,flag)strName = ws.RegRead( nicID & "Name")If strName = "" Thenelse if InStr(strName, "1394") = 0 then' MsgBox strName ws.RegWrite nicID & "ShowIcon", flag, "REG_DWORD" end ifend ifEnd Sub
cluberti Posted June 8, 2006 Posted June 8, 2006 (edited) I think I'll use some of that one and modify my own... Edited June 8, 2006 by cluberti
Yzöwl Posted June 8, 2006 Posted June 8, 2006 Of course it can be done with a batch file@ECHO OFF &SETLOCAL ENABLEEXTENSIONSSET "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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now