We are connecting laptops running Windows 7 Professional to wireless access points which, for security reasons, automatically regenerate a new wifi key every time they are powered off/on (which happens frequently). I understand that I can uncheck the "connect automatically" box when connecting to the network and this will keep the password from being stored but I am looking for a way to have that box be unchecked as the default value so that the user won't have to manually uncheck it every time. We have several different types of laptops purchased across a number of years, is there a universal way that I can disable that check box?


It would actually be preferable if there were a way to automatically "forget" the password on disconnect but still attempting to connect to the network automatically and simply prompting for the password.


You can follow the instructions in this SuperUser thread to set an automated task to trigger on network disconnection.

You can have the triggered task call a batch file with the following command:

netsh wlan set profileparameter name=<NAME OF WIRELESS CONNECTION> keyMaterial=SOMEunGues7123Able^&@Value

You can find the name of the wireless network with the command netsh wlan show profiles. In this approach, a blank password is not allowed so I have set an unguessable password. The next time the user connects, it will generate a password error and prompt them to enter the correct password.

As an alternative approach, you could simply delete the whole profile on disconnection with the command: netsh wlan delete profile name=<NAME OF WIRELESS CONNECTION>. That matches your first option, but not your "forget" option, for which the former seems to be the most practical way.

  • The first solution (setting the key to something else) doesn't actually work on the majority of these laptops (for some it does, though I couldn't tell you why one way or the other). If it did work I would be fine to simply leave the old wifi key in place and let it prompt for the new key. They end up not prompting and not connecting. – S.Nishizaki Jan 28 '16 at 0:07
  • 1
    The second solution, while not what I had asked in my original question, does what, at the end of the day, I needed it to. I modified it for my own purposes and I will post the changes here for others. I did create a task but I went ahead and set it to run at system start up (so that if the laptop was moved out of range and back in to range the user wouldn't have to reenter the password). I also changed the command since the computers actually might connect to any number of different wireless networks: netsh wlan delete profile * – S.Nishizaki Jan 28 '16 at 0:23

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.