I am looking on how to connect to a WiFi SSID on Windows OS, but I have not been successful.

First of all I tried using windows commands like:

netsh connect ssid=SSIDNAME name=PROFILENAME

This works fine, but the problem is that this procedure requires the XML profile. Unfortunately, if this connection is a new one, then the profile did not exist. Then I looked around to know how to generate these profiles. Looking to the MSDN documentation I see some templates, but I did not see any straightforward way to create the profile with the only password “parameter”.

I found this (https://gallery.technet.microsoft.com/scriptcenter/OMA-URI-Custom-Wifi-6f146d6b) PowerShell script from a member of Microsoft that allows the connection of custom wifi WPAPSK and WPA2PSK, but still not enough. The connection type could be anything, including WEP or others. What I am looking for is something like Windows Dialog (rundll32.exe van.dll,RunVAN) that if you click on some WiFi SSID the unique requirement is to input the password, but this has to be done by some script, executable, etc.

If there is no a easy way to auto-connect knowing the password, then another idea I have got it to “do the job” is interact with the dialogs by sending keys or mouse events to the appropriate dialog. Any solutions?

Thanks you all

1 Answer 1


Try creating the wireless profile xml file and then setting it to autoconnect.

Those files are stored C:\ProgramData\Microsoft\Wlansvc\Profiles\Interfaces, and then in the folder that contains your interface.

The format of the xml file is pretty straightforward.

For details on the encryption, see here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.