Jump to content

Help with Regread for wireless connections


Recommended Posts

I'm a noob here so please excuse me if this has been covered already.. I've done a bit of searching. I'm imaging a number of different model dell laptops and desktops w/ and w/o wireless nics. I've come up with a solution to add our wireless profiles as well as selecting and connecting to the network automatically. My issue is being able to distinguish which ones have wireless nics and which ones do not.

Basically if it has wireless I need it to run my other scripts and if it does not then just move on. Regread looks like it'd come in handy for this situation.

"HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}"

Is the registry key I found but since we have different wireless nics the keys change from there, and I just need to determine if it has "Wireless Network Connection" or not in those sub keys to run. I can retrieve the names of the connections running this script I found on here but got a bit lost trying to write a conditional statement from there. Sorry I'm a bit long winded but hopefully I was at least clear. Thanks for any help in advance.

Dim $i

;Get Network Connection Names

$base = "HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}"

While 1

$i += 1

$key = RegEnumKey($base, $i)

If @error <> 0 Then ExitLoop

$name = RegRead($base & "\" & $key & "\Connection", "Name")

ConsoleWrite($name&@CRLF)

WEnd

Link to comment
Share on other sites

This is working for me

;
Local $i = 0
;Get Network Connection Names
$base = "HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}"
While 1
$i += 1
$key = RegEnumKey($base, $i)
If @error <> 0 Then ExitLoop
$name = RegRead($base & "\" & $key & "\Connection", "Name")
If StringInStr($name, "Wireless") Then
   MsgBox(0, "Result",  $Name)
EndIf
WEnd
;

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Glad it worked for you.

By the way You can speed that up by adding one line of code to exit the loop if a wireless is found.

;
Local $i = 0
;Get Network Connection Names
$base = "HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}"
While 1
$i += 1
$key = RegEnumKey($base, $i)
If @error <> 0 Then ExitLoop
$name = RegRead($base & "\" & $key & "\Connection", "Name")
If StringInStr($name, "Wireless") Then
   MsgBox(0, "Result",  $Name)
   ExitLoop
EndIf
WEnd
;
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...