Jump to content

LAN connection icon on taskbar


Recommended Posts

I need help with one of the few remaining annoyances with my XP Home unattended CD. This one involves showing the network connection icon in the notification area (far right end of the taskbar). My configuration consists of XP Home with SP3 slipstreamed by nLite.

I found two similar registry changes, but neither works. I can kinda see what these commands are doing, but I'll admit they're a little confusing. When I try to run them from a cmd file after Windows is installed, I get the message "Error: Invalid key name."

Posted by Yzöwl on June 8, 2006:

@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

Posted by Yzöwl on June 20, 2007:

@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

In each case, here's what the path and values in my registry look like before and after running those commands:

HKEY_LOCAL_MACHINE
SYSTEM
CurrentControlSet
Control
Network
{4D36E972-E325-11CE-BFC1-08002BE10318}
{161FABAC-493B-442F-B74F-FE36B1C73E3B}
Connection

"PnpInstanceID"="PCI\\VEN_10EC&DEV_8139&SUBSYS_000113E0&REV_10\\4&2AF9ED5&0&10F0"
"MediaSubType"=dword:00000001
"Name"="Local Area Connection"

Outside of the registry, you can get to this setting in Control Panel ~ Network Connections ~ Local Area Connection ~ Properties ~ General. There's a checkbox in the bottom of the window to "Show icon in notification area when connected".

Any ideas on how to turn on this icon when Windows is installed?

TIA

Link to comment
Share on other sites


Both scripts should at least add the Dword ShowIcon value under "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{161FABAC-493B-442F-B74F-FE36B1C73E3B}\Connection" and set to 1.

Most likely, the board added trailing spaces or Carriage return and you need to fix your batch.

I added a batch that will do what you need. All credit goes to Yzöwl as i only removed some part of the first script to allow easy debugging and it will work even if your connection name doesn't match the search string.

Link to comment
Share on other sites

Both scripts should at least add the Dword ShowIcon value under "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{161FABAC-493B-442F-B74F-FE36B1C73E3B}\Connection" and set to 1.

I agree. If I manually add the value, I do see the icon and it remains visible even after a reboot so I know I'm on the right path.

To test this, I removed the ECHO OFF line and replaced the GOTO with a pause so I could see what's going on. Here's the revised cmd file:

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 (REG ADD "%%?" /V ShowIcon /T REG_DWORD /D 1 /F)
ENDLOCAL

pause

And here's the result:

post-136345-0-73371300-1308423998_thumb.

I don't think the parentheses are necessary around the DO command and I'm not sure why \\Connection$ isn't just \Connection. It appears to work the same either way. Most importantly, notice the female symbol before the HKEY. That's an ASCII 12 or FF character. I don't know where it's coming from but it is clearly making the key name invalid.

Edited by NOTS3W
Link to comment
Share on other sites

Here's something interesting but I don't know if it helps solve the problem. I stripped the batch file down to just echo each line of output from the REG QUERY command:

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') DO echo %%?
ENDLOCAL

pause

It's output:

post-136345-0-03950900-1308449423_thumb.

Notice the same strange character echoed as the first line of REG QUERY.

Link to comment
Share on other sites

You might have got a strange reg.exe it should be "5.1.2600.5512" with xp sp3. Could you check it ?

Also try

REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} /S >c:\regpb.txt

and attach the resulting regpb.txt.

Edited by allen2
Link to comment
Share on other sites

You might have got a strange reg.exe it should be "5.1.2600.5512" with xp sp3. Could you check it ?

Also try

REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} /S >c:\regpb.txt

and attach the resulting regpb.txt.

My version of reg.exe is exactly as you expected 5.1.2600.5512. It's in C:\Windows\System32.

I appreciate your help with this. I'm stumped. Evidently, no one has encountered a problem since Yzowl posted this method 5 years ago. I think I know a little something about DOS and batch files, but I can't figure this out.

The regpb.txt file is attached.

regpb.txt

Link to comment
Share on other sites

Ok so there is nothing wrong with reg and the output of reg isn't one creating the strange char.

Then you could try this:

REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}" /S >%temp%\tmp_reg_conn.txt
findstr \\Connection$ %temp%\tmp_reg_conn.txt >%temp%\tmp_net_conn.txt
FOR /F "delims=" %%i IN (%temp%\tmp_net_conn.txt) DO (REG ADD "%%i" /V ShowIcon /T REG_DWORD /D 1 /F)

pause
del /q %temp%\tmp_net_conn.txt
del /q %temp%\tmp_reg_conn.txt

If this still doesn't work then attach the two tmp files in your next post as it might help to resolve the problem.

Also to be sure the board doesn't mess the syntax i attached the file.

Link to comment
Share on other sites

That worked! Somehow writing to a file and reading it back drops that odd character. I just created a new unattended CD with these new lines in GuiRunOnce and installed Windows. The icon is now alive and well on the taskbar. Good thinking. Thank you. :thumbup

Link to comment
Share on other sites

It must have something to do with my system. Yzowl posted the original method several years ago and I never saw anyone say it didn't work for them.

My only remaining question is why, if I'm searching the REG QUERY output file for the word "\Connection" does the FINDSTR command have "\\Connection$"? I know that some commands require double backslashes when reading and writing single backslashes, but what is the $ for?

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...