Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

LAN connection icon on taskbar

- - - - -

  • Please log in to reply
12 replies to this topic

#1
NOTS3W

NOTS3W

    Member

  • Member
  • PipPip
  • 117 posts
  • Joined 19-April 07
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


How to remove advertisement from MSFN

#2
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,814 posts
  • Joined 13-January 06
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.


#3
NOTS3W

NOTS3W

    Member

  • Member
  • PipPip
  • 117 posts
  • Joined 19-April 07

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:

Attached File  Notify Icon Result.jpg   65.75KB   17 downloads

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, 18 June 2011 - 01:14 PM.


#4
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,814 posts
  • Joined 13-January 06
You have a strange character before the HKey on the Reg add line.
Could your try adding this following line before the "for" line ?
chcp 437


#5
NOTS3W

NOTS3W

    Member

  • Member
  • PipPip
  • 117 posts
  • Joined 19-April 07
Sure. Here's what I get:

Attached File  Result2.jpg   66.66KB   3 downloads

#6
NOTS3W

NOTS3W

    Member

  • Member
  • PipPip
  • 117 posts
  • Joined 19-April 07
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:

Attached File  Result3.jpg   162.9KB   7 downloads

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

#7
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,814 posts
  • Joined 13-January 06
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, 18 June 2011 - 10:23 PM.


#8
NOTS3W

NOTS3W

    Member

  • Member
  • PipPip
  • 117 posts
  • Joined 19-April 07

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.

Attached File  regpb.txt   1.13KB   6 downloads

#9
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,814 posts
  • Joined 13-January 06
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.

#10
NOTS3W

NOTS3W

    Member

  • Member
  • PipPip
  • 117 posts
  • Joined 19-April 07
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

#11
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,814 posts
  • Joined 13-January 06
Great to hear this because i was about to give up doing it with a batch.

#12
NOTS3W

NOTS3W

    Member

  • Member
  • PipPip
  • 117 posts
  • Joined 19-April 07
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?

#13
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,814 posts
  • Joined 13-January 06
$ mean end of line when used with findstr.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users