Category filter

Script to fetch list of previously connected Wi-Fi networks on Windows

Administrators might want to monitor the Wi-Fi networks that their corporate devices connect to. It helps them ensure that the devices only connect to safe Wi-Fi networks. Hexnode lets admins
deploy scripts
to get a list of previously connected Wi-Fi networks.

Note:


Supported Versions:

The scripts given below will be supported on the following versions:

  • Windows 10 v1607+ (Pro, Enterprise, Education)
  • Windows 11 (Pro, Enterprise, Education)


Disclaimer:

The Sample Scripts provided below are adapted from third-party Open-Source sites.

Fetch the list of previously connected Wi-Fi networks

When the device is connected to a Wi-Fi network, it creates a WLAN profile that consists of details specific to the network.

Batch script

The following Batch script retrieves a list of all Wi-Fi networks accessed from the device.

PowerShell Scropt

The PowerShell script to obtain the previously accessed Wi-Fi networks from a Windows device takes the following form:

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

Sample Script Repository