Link to home
Start Free TrialLog in
Avatar of Garry Shape
Garry ShapeFlag for United States of America

asked on

XP Command help with reg import and renaming item

In HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EAPOL\Parameters\Interfaces\{259068B4-2BFE-4EEE-A682-0C4EF7FDF41C}
The profiles are listed in numerical order.

How can I delete any existing Registry entry in this key above that contain the word "NetworkName2" in the REG_BINARY data?

The number list order could be anything from 1 - 99, and I don't want to delete other wireless networks.

Here's where it's at when you double-click the REG_BINARY item, as you can see there's a "Networkname2" listed in there:
User generated image
Avatar of John
John
Flag of Canada image

Those registry entries are there to be used (and sometimes over again) on most operating systems from XP forward.

Why do you need to delete keys being used?  You could do some damage. They should not be causing any problems.
Avatar of Garry Shape

ASKER

Because I'm trying to deploy a wireless profile that uses PEAP authentication, and after importing, I need to replace the registry entry in this key that is generated when the wireless profile is imported via a third party utility.

Back-story:

This is a target of Win XP Embedded systems, all the same computer models, and I'm trying to deploy a wireless network profile to the computers that connects to a wireless network using PEAP.

The challenge is that netsh wlan commands are not available in this XPE environment, so I cannot export/import with netsh.

So that leads me to use this Symantec Wifi tool that exports wireless profiles to XML (http://www.symantec.com/connect/articles/how-capture-and-deploy-wlan-profiles).
 
However, Symantec's tool will not export a wireless profile if PEAP is selected in Authentication, as you'll read on that article's comments section.

So, what I've done is, per one of the comments in that article, for exporting:
1. Exported the REG key entry of the wireless network while it is configured how I like.
2. Edited the .reg file in Notepad, leaving only the Entry that contains the "Networkname2" in the item data, which has all the encrypted setting info on PEAP authentication, etc.  
3. Then I changed the wireless to something besides PEAP so that the Symantec Wifi tool could export the wireless profile to XML. Now I have my Symantec wifi export xml of this wireless profile.

Then, for importing to another computer, I must now do the following:
1. Use the Symantec wifi tool to import -- problem
2. Wifi profile is now imported, but it doesn't have the right settings I want.
3. I then import the .reg file I exported in the exporting steps, but now this is a duplicate entry with a different number, and Windows is not reading this reg entry for the wireless network with the same name.

So I either need to somehow delete the other one, or overwrite it upon importing the registry.
There is more than one place for this key. Did you get all the places?  This is dangerous work.

If you can find all the right places (depends on machine) then overwriting the values is probably the best choice.
I'll search some more but I'm not finding what other places in the registry are relevant to this key's entry.
I just know that manually, if I import the .reg file, it adds the new entry. And my wireless is still not setup right.
But if I delete the generated reg entry, leaving the imported one (which contains the same wireless network name as the  generated one I deleted), my wireless settings are all better now and configured properly, functioning just fine.
So I'm just trying to automate this without having to use the registry GUI
Try using the wireless setup tool to set it up. Much more reliable.

The registry is not a user tool for this use (I did read your reasoning). There are multiple sections for the same thing and not all done in the same way.

Good luck with this and I hope you do not hose the machines.
The wireless setup tool doesn't work for a hundred users running a slimmed, locked-down XP Embedded thin client system. The systems will definitely get messed up relying on users, and I can't run around to every machine doing it.

The alternative to this is a GUI-automated method I have created in AutoIT, which uses the Aruba wifi tool to remove ssid network profiles, then handles the opening of ncpa.cpl, opening the wireless applet, adding in the network through ControlClick's, etc.
But that still brings up interruption to the Explorer interface for end-users.

For GPO methods, I've got the Wireless network implemented for Windows 7 machines just fine.
You need to look in Control Set, all the Control Set backups (at least 2) and all the locations that hold the hardware.

Again, good luck.
Avatar of oBdA
oBdA

Try if this works for you then; note that "Networkname2" has to be written exactly as it is (not "NeworkName2",  "networkname2", or "Network name 2"), matching the value in the screenshot, not in your question. The script is in test mode and will only echo out the "reg delete" command it would normally run, so that you can test it. Remove the uppercase ECHO in line 14 to run it for real:
@echo off
setlocal enabledelayedexpansion
REM *** "Networkname2" in binary format; the string (not the hex) is CaSe SeNsItIvE!
set FindBinary=4E6574776F726B6E616D6532
set EapolKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EAPOL\Parameters\Interfaces\{259068B4-2BFE-4EEE-A682-0C4EF7FDF41C}
echo Analyzing '%EapolKey%':
for /f "tokens=1,2*" %%a in ('reg.exe query "%EapolKey%" ^| find "REG_BINARY"') do (
	echo Index '%%a' ...
	echo %%c|find /i "%FindBinary%" >NUL
	if errorlevel 1 (
		echo ... not found.
	) else (
		echo ... found; removing ...
		ECHO reg.exe delete "%EapolKey%\%%a" /f
	)
)

Open in new window

@oBdA

Thanks for the feedback. It looks like that's getting somewhere.
It will echo if found but if I remove the ECHO to leave the reg.exe....etc like you advised, it will say "Error:  The system was unable to find the specified registry key or value".

Do you know what else I might have to change to fix that?

Also is there a way, that once it's found, to store that 1 particular reg entry as a variable, import a reg that contains the same Binary value hex (wireless name) in it, then delete the saved variable entry, leaving the other entry?
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok thanks I will try

Sorry for the confusion, the reasoning is:

1. The reg entry I'm deleting is one that has the correct wireless network SSID in it, but doesn't have the right settings for other things about the wireless profile, such as PEAP authentication settings, etc.
2. The reg entry I'm importing, has the same wireless network SSID as the one I deleted, but it contains the correct wireless profile settings that are required.

So after the wireless network is imported with a third-party executable, Windows XP automatically itself generates a registry entry in that key, say, index 3. Index 3 entry has the right wireless SSID in the binary data, but the wrong settings.
Now when I import the .reg export from another computer where I had the right wireless settings, now we have an Index 4 reg entry, which is the entry with the correct settings.

So when I run the script, instead of just deleting the useless Index 3 entry, it's going to also delete Index 4.

I had to export the reg of the wireless because, with the third-party Wireless profile backup utility, it would not export the wireless profile due to PEAP settings being in place. So I had to export the reg with the peap settings in place, change the wireless to remove PEAP, and THEN the third-party utility would backup the wireless profile.

So that's why I now have to import with the third party wireless utility, import the .reg file containing the right settings for the wireless profile, then delete the reg entry that contains the invalid settings.
Actually, it looks like I can import the reg file after deleting the key registry entries and it continues to work. let me try to get it all together and try again on another system
Thanks, so so much. Works like a charm.