
The module does not provide a cmdlet to disconnect a WLAN connection, so you have to use netsh for that: netsh wlan disconnect interface="Wi-Fi" This is done by calling the cmdlet Connect-WiFiProfile -ProfileName MyWiFiĪs optional parameters, it accepts the AdapterName, which can be determined as described above, as well as ConnectionMode to override the setting from the profile. Once the required profile is created, you can use it to connect to the corresponding network. Then run the command like this: New-WiFiProfile -XmlProfile $profile For this, you first load the XML file into a variable, not as an XML structure, but as plain text: $profile = gc -Raw. The cmdlet supports the XmlProfile parameter for this purpose. The exported profile could be transferred to other computers and imported there with New-WiFiProfile. Note that only the user who created the profile will see the decrypted password. So for a complete XML export, you also must add this parameter.
You can output it by adding the ClearKey switch: Get-WiFiProfile -ProfileName MyWiFi -ClearKey | select Password In this example, the profile will be exported without the password.

To do this, write the XML property to a file: (Get-WiFiProfile -ProfileName MyWiFi).XML | Out-File. This cmdlet also allows you to export the WiFi profile as an XML file (see Microsoft's examples for the exact format of the profiles). With Get-WiFiProfile you can make sure that the profile has been created and check its properties. Show and export profiles, read password ^

The authentication method must, of course, be supported by the WLAN. For ConnectionMode, you can choose between manual and auto, which corresponds to selecting or deselecting the Connect automatically option in the GUI.
