; ; AutoHotkey Version: 1.x ; Language: English ; Platform: Win9x/NT ; Author: A.N.Other ; ; Script Function: ; Sets the Registry key for the option "show icon in notification area when connected" ; of every real network adapter in windows pe ; #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #SingleInstance force nopemsg = 0 quiet = 0 progname = Show icon in notification area when connected ; test for command line parameters if 0 > 0 { Loop, %0% ; For each parameter: { if %A_Index% = /nopemsg nopemsg++ else if %A_Index% = /quiet quiet++ } } If nopemsg = 0 { ; Test if running in BartPE RegRead , PEBuilder , HKLM , System\CurrentControlSet\Control\Pe Builder , Name If ErrorLevel { MsgBox , 308 , %progname%? , You are about to start this app on 'real' Windows, are you sure?`n`n`nUse the command line parameter /nopemsg to turn off this message. IfMsgBox No Return } } If quiet = 0 { ; checkback to avoid unintentional execution MsgBox , 308 , %progname%? , Do you want to "%progname%" for all network adapters?`n`n`nUse the command line parameter /quiet to turn off this message. IfMsgBox No Return } ; abbreviations for RegKeys LoopKey = SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318} IconSubkey = SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} IconSubkey001 = SYSTEM\ControlSet001\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} ; loop CLSIDs of all 'network devices' and search for 'real network adapters' with Characteristics=132 Loop , HKLM , %LoopKey% , 2 { RegRead , Characteristics , HKLM , %LoopKey%\%A_LoopRegName% , Characteristics If (Characteristics = 132) { ; Characteristics=132 --> 'network adapter' found --> read CLSID RegRead , NetworkCard , HKLM , %LoopKey%\%A_LoopRegName% , NetCfgInstanceId ; write ShowIcon for this network adapter to CurrentControlSet RegWrite, REG_DWORD, HKLM, %IconSubkey%\%NetworkCard%\Connection , ShowIcon, 0x00000001 If ErrorLevel Msgbox , 16 , %progname%? , RegWrite failed:`n[HKEY_LOCAL_MACHINE\%IconSubkey%\%NetworkCard%\Connection]`n"ShowIcon"=dword:00000001 ; write ShowIcon for this network adapter to ControlSet001 RegWrite, REG_DWORD, HKLM, %IconSubkey001%\%NetworkCard%\Connection , ShowIcon, 0x00000001 If ErrorLevel Msgbox , 16 , %progname%? , RegWrite failed:`n[HKEY_LOCAL_MACHINE\%IconSubkey001%\%NetworkCard%\Connection]`n"ShowIcon"=dword:00000001 } }