netsh add profile returns "An attempt was made to load a program with an incorrect format."

2

Using netsh, I used the following command to add a wireless profile

add profile filename="c:\profiles\DLINK-Profile.xml" interface="D-Link DWA-125 N150"

All parameters are valid. But I get the error "An attempt was made to load a program with an incorrect format."

I know this error is related to OS architecture 64bit or 32 bit. But i'm not sure which program is not compatible.

I'm using Win7 64bit

Tunisia

Posted 2012-02-05T09:50:31.693

Reputation: 21

Answers

2

In the XML file, check the value in <keyMaterial></keyMaterial> for the following characters and replace accordingly:

"   -> &quot;
&   -> &amp;
'   -> &apos;
<   -> &lt; 
>   -> &gt;

For example, if your WiFi passphrase is listed as P@ssw0rd&123, replace it with P@ssw0rd&amp;123

XML sees the above predefined entities as markup and breaks the ability of the netsh command to parse the XML file properly.

TGT

Posted 2012-02-05T09:50:31.693

Reputation: 21

0

It should be something like this:-

netsh wlan add profile filename="PATH_AND_FILENAME.xml" Interface="Wireless Network Connection" user=current

Refer Importing and Exporting Windows Network Settings for more info

Siva Charan

Posted 2012-02-05T09:50:31.693

Reputation: 4 026

0

I was getting the same error with this command, and in my case, it turned out to be an extremely misleading error message. It was an issue with the format of the XML profile file I was using, not any kind of CPU architecture mismatch.

Specifically, if you're basing your profile on the examples found here, like I was, the examples include the following line:

<?xml version="1.0" encoding="US-ASCII"?>

Try removing that line — once I did, it solved the issue and let me add the profile.

(Expanding on TGT's answer above, it seems that any formatting problem with the XML causes netsh to throw that error. For example, I went in and deleted a few characters from a working profile XML file, so that it wasn't even well-formed XML anymore, and tried to add it. It failed with the same error.)

user1454265

Posted 2012-02-05T09:50:31.693

Reputation: 161