Jump to content

Need help making a reg query batch.


Recommended Posts

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 by BoardBabe
Link to comment
Share on other sites


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 name

in 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, InTa

StrComputer = "."

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")

Link to comment
Share on other sites

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 by Yzöwl
Link to comment
Share on other sites

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 with

HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{65FA9572-A7DB-42EE-8EC5-1D1D41E299FA}\MTU: 0x000005DC

So therefore I need to find this {65FA9572-A7DB-42EE-8EC5-1D1D41E299FA} value so I get the correct registry string for my WLAN NIC.

Link to comment
Share on other sites

Study WMIC, it is really awesome command...

You can use "where", so you can select only one NIC... For example

WMIC NicConfig Where Description="Broadcom NetXtreme" Set SetMTU = 1500

The "HowTo" is simple. Run command

Wmic NicConfig list full

Find your NIC and find unique settings that it contains... Thats all.

Link to comment
Share on other sites

@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 by BoardBabe
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 MTU

CWMIC NicConfig Where Description="Intel(R) PRO
/Wireless 2200BG Network Connection - Miniport for pakkeplanlegger" GET MTU

displays:

MTU
1500

Can you try set your mtu with WHERE and see if you get it working?

Edited by BoardBabe
Link to comment
Share on other sites

  • 4 months later...

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