Apologies, I'm going to answer my own question here, but I thought I'd post this for the benefit of others.
I recently re-installed the latest version of Windows 10 64-bit onto my HP Elitebook 840 G2, plus a couple of apps, and then I noticed my WiFi was not working. Whenever I disconnected the Ethernet, the WiFi would briefly show the WiFi SSIDs before turning itself off.
TLDR:If you've installed a VPN client you may have added a TAP adapter to your list of network adapters. This looks like another Ethernet connection and so your laptop assumes you are still connected to a wired network and therefore it turns off your WiFi. Either disable this TAP adapter, or configure it only to be active when your VPN is active. See more below.
After a reinstall of Windows 10 on my HP EliteBook 840 G2, I found that I could not get the WiFi to work.
The hardware Wifi button in the top right corner of the laptop was showing white. Whenever I discconect the Ethernet cable you would get the globe symbol in the system tray. If you turned WiFi on from this pop-up, you would see the list of SSIDs and then they would disappear one second later and the WiFi would show disconnected. The fact they appeared showed the adapter was physically working.
The machine dual-booted to Linux and there were no problems there, so this was clearly a Windows [driver] problem.
Nothing was visible in the Event Log.
I ran the network troubleshooter and it said:
Result of diagnosis: Problem found
Wireless capability is turned off
Detailed root cause:
Radio is off (SW switch)
Turn on wireless capability
The correct drivers had been installed.
I had unchecked the "Allow the computer to turn off this device to save power".
I uninstalled the drivers.
I installed the HP Wireless Button Driver.
The WiFI/LAN switching was turned off in the BIOS.
My list of network adapters included a TAP-Windows Adapter. This is deemed to be an ethernet connection. Although you disconnect the physical ethernet connection ("Ethernet" in my list), the Ethernet2 remains virtually "connected". And Windows will not allow both an Ethernet and a Wifi connection to remain active simultaneously, so it turns off your Wifi again. Disabling this allowed the Wifi to work continuously.
Examining the TAP adapter, I could see it was installed by a VPN provider.
Clicking the properties, I could see a setting "Media Status". It defaulted to Always Connected. Setting this to "Application Controlled" meant that the adapter would only be active when the VPN demanded it, thus it would be disabled at other times. This meant that if the physical ethernet was disabled and the VPN was not active, the TAP adapter would be disabled and WiFi would resume. Voila!
Be alert for scammers posting fake support phone numbers and/or email addresses on the community. If you think you have received a fake HP Support message, please report it to us by clicking on "Flag Post".