September 16, 200520 yr I need to find out the keystring of my WLAN NIC using a batch query, as I believe this changes on each install. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\13]"ServiceName"="{65FA9572-A7DB-42EE-8EC5-1D1D41E299FA}""Description"="Intel(R) PRO/Wireless 2200BG Network Connection"So I need a batch that search for Description "Intel® PRO/Wireless 2200BG Network Connection" in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\XX and then return the ServiceName value ({65FA9572-A7DB-42EE-8EC5-1D1D41E299FA}).Please help me out here! Ive really tried myself but cant figure it out. Yzöwl, I know you know this hehe care to help out? Edited September 16, 200520 yr by BoardBabe
September 16, 200520 yr I do not know if this will help but here is a script that checks for the name of the Network Card using a WMI in a vbs script. This has my and your cards namein the array.This script also run a check for working and not working devices and then makes a txt file that list the results.Blue Text Is The Array For The Network Cards.Dim Act, Fso, StrComputer, ChkNCard, Wmi_1, Wmi_Class, InTaStrComputer = "." Set Act = CreateObject("Wscript.shell") Set Fso = CreateObject("Scripting.FileSystemObject") Wmi_1 = ("winmgmts:\\" & strComputer & "\root\cimv2") Wmi_Class = Array(("Select * from Win32_PnPEntity"),("Select * from Win32_Processor") ) ChkNCard = Array(("VIA Rhine II Fast Ethernet Adapter"),_ ("Intel® PRO/Wireless 2200BG Network Connection")) ''' List Network Adaptor Name Set objWMIService =GetObject(Wmi_1) Set colNCard = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter",,48) For Each objItem in colNCard For Each StrChkNCard In ChkNCard If objItem.Name = StrChkNCard Then Act.Popup "Network Card Name : " & objItem.Name,5,"Confirmed", 0 + 64 End If Next Next '''' List What Devices Are Working InTa = 100 Set Ts = Fso.OpenTextFile("HWListError.txt",2,True) TS.WriteLine " <----- Error Code Check 1 Working Devices ----->" TS.WriteLine " <----- Time Start = " & Time() & " ----->" Set objWMIService = GetObject(Wmi_1) Set colItems = objWMIService.ExecQuery(Wmi_Class(0) & " WHERE ConfigManagerErrorCode <> 1") For Each objItem in colItems InTa = InTa + 1 TS.WriteLine Vbcrlf & " <----- Number Of Device Counter = " & InTa & " ----->" TS.WriteLine " Class GUID: " & objItem.ClassGuid TS.WriteLine " Description: " & objItem.Description TS.WriteLine " Device ID: " & objItem.DeviceID TS.WriteLine " Manufacturer: " & objItem.Manufacturer TS.WriteLine " Name: " & objItem.Name TS.WriteLine " PNP Device ID: " & objItem.PNPDeviceID TS.WriteLine " Service: " & objItem.Service & vbCrLf & " <---------------------------------->" Next TS.WriteLine " <----- Time Finished = " & Time() & " ----->" TS.WriteLine " <----- Total Amount Of Checks = " & InTa & " ----->" TS.Close InTa = InTa - InTa InTa = 1 - 1 '''' List What Devices Are Not Working InTa = 1000 Set Ts = Fso.OpenTextFile("HWListError.txt",8,True) TS.WriteLine " <----- Error Code Check 0 Not Working Devices ----->" TS.WriteLine " <----- Time Start = " & Time() & " ----->" Set objWMIService = GetObject(Wmi_1) Set colItems = objWMIService.ExecQuery(Wmi_Class(0) & " WHERE ConfigManagerErrorCode <> 0") For Each objItem in colItems InTa = InTa + 1 TS.WriteLine Vbcrlf & " <----- Number Of Device Counter = " & InTa & " ----->" TS.WriteLine " Class GUID: " & objItem.ClassGuid TS.WriteLine " Description: " & objItem.Description TS.WriteLine " Device ID: " & objItem.DeviceID TS.WriteLine " Manufacturer: " & objItem.Manufacturer TS.WriteLine " Name: " & objItem.Name TS.WriteLine " PNP Device ID: " & objItem.PNPDeviceID TS.WriteLine " Service: " & objItem.Service & vbCrLf & " <---------------------------------->" Next TS.WriteLine " <----- Time Finished = " & Time() & " ----->" TS.WriteLine " <----- Total Amount Of Checks = " & InTa & " ----->" TS.Close Act.Run("HWListError.txt")
September 16, 200520 yr Author Well, I really never used any vbs scripts. but I tried run this script and it output way too much. I really just need the value of ServiceName so that I can use it as a %variable% to set a registry key with it.
September 16, 200520 yr What exactly are you wanting it for?Have you got more than one Network card? If yes then do any of them need setting up differently?I only ask because it may be better to build that functionality into the batch. Edited September 16, 200520 yr by Yzöwl
September 16, 200520 yr Author Oh sorry. I have 2 NICS, one WLAN and one LAN. I would like to set the MTU of only the WLAN card to 1500. This is done withHKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{65FA9572-A7DB-42EE-8EC5-1D1D41E299FA}\MTU: 0x000005DCSo therefore I need to find this {65FA9572-A7DB-42EE-8EC5-1D1D41E299FA} value so I get the correct registry string for my WLAN NIC.
September 16, 200520 yr Its not really nice way to do this through registry - you can use commandWmic nicconfig set SetMTUinstead
September 16, 200520 yr Author Hmm never heard of that method, can you explain how I can set MTU to 1500 on only one specific NIC? Edited September 16, 200520 yr by BoardBabe
September 16, 200520 yr How about using AutoIT?Check out the RegEnumKey, RegEnumVal, RegRead, RegWrite functions.They should be able to do what you are looking to do.
September 16, 200520 yr Study WMIC, it is really awesome command... You can use "where", so you can select only one NIC... For exampleWMIC NicConfig Where Description="Broadcom NetXtreme" Set SetMTU = 1500The "HowTo" is simple. Run commandWmic NicConfig list fullFind your NIC and find unique settings that it contains... Thats all.
September 16, 200520 yr Author @Joe User 99: AutoIt is oute of the question @Martin Zugec: I'll try look into this command. Looks interesting, but whats the benefit over regedit it?hmm Im trying your command, but all i get is an error code 0x80041002. Edited September 16, 200520 yr by BoardBabe
September 16, 200520 yr Simple - no need for identificators etc... And the main reason is that when you know syntax of WMIC, you can access ANYTHING (really )
September 16, 200520 yr Author Ok, It sounds like a good idea if I can just get it working. I tried with Description = ... but didnt work so then i tried with MAC, but I still get an error and cant set MTU. is this line correct?WMIC NicConfig Where MACAddress="00:0E:35:2C:20:A7" Set SetMTU = 1500
September 16, 200520 yr Author Sorry still nothing Ive tried numerous ways, but I cant get it working, but it seems like the perfect thing for my use if I can get it correct...This however works to GET MTU, but I cant figure out the correct way to SET MTUCWMIC NicConfig Where Description="Intel(R) PRO/Wireless 2200BG Network Connection - Miniport for pakkeplanlegger" GET MTUdisplays:MTU1500Can you try set your mtu with WHERE and see if you get it working? Edited September 17, 200520 yr by BoardBabe
February 2, 200620 yr Study WMIC, it is really awesome command...hi, is there a way to set registry keys using wmic?! one can do really amazing stuff with the wmic commands, but i don't find a possibility to edit/create/delete reg.keys.. maybe someone could help me.thx in advance
Create an account or sign in to comment