Module used for management of wireless profiles.
This module leverages the native WiFi functions. I wanted to learn more about interoperability and have a PowerShell (not using netsh.exe) way to view passwords of WiFi profiles so I decided to work on this in my free time. Any feedback on how this module can be improved is welcome.
Drop the root folder in your PSModulePath, remove the branch name (ex. -dev )from the folder, and PowerShell should find the module.
- Get-WiFiProfile Retrieves the information of a WiFi profile.
- Set-WiFiProfile Overwrites a existent WiFi profile.
- New-WiFiProfile Creates a new WiFi profile.
- Remove-WiFiProfile Deletes a WiFi profile.
- Get-WiFiAvailableNetwork Retrieves the list of available networks on a wireless LAN interface.
- Get-WiFiConnectedNetworkInfo Retrieves the detailed information of connected wireless networks.
- Connect-WiFiProfile Attempts to connect to a specific network.
- Search-WiFiNetwork Requests a scan for available wifi networks.
- ProfileName: The name of the WiFi profile. If not specified, The function will return all profiles.
- WiFiAdapterName: Specifies the name of the wireless network adapter on the machine. This is used to obtain the Guid of the interface. The default value is 'Wi-Fi'
- ClearKey: Specifies if the password of the profile is to be returned.
- ProfileName: The name of the WiFi profile to modify.
- ConnectionMode: Indicates whether connection to the wireless LAN should be automatic ("auto") or initiated ("manual") by user. The default is "auto".
- Authentication: Specifies the authentication method to be used to connect to the wireless LAN. ('open', 'shared', 'WPA', 'WPAPSK', 'WPA2', 'WPA2PSK', 'WPA3SAE', 'WPA3ENT192', "OWE")
- Encryption: Sets the data encryption to use to connect to the wireless LAN. ('none', 'WEP', 'TKIP', 'AES', 'GCMP256')
- Password: The network key or passpharse of the wireless profile in the form of a secure string.
- ConnectHiddenSSID: Specifies whether the profile can connect to networks which does not broadcast SSID. The default is false.
- EAPType: (Only 802.1X) Specifies the type of 802.1X EAP. You can select "PEAP"(aka MSCHAPv2) or "TLS".
- ServerNames: (Only 802.1X) Specifies the server that will be connect to validate certification.
- TrustedRootCA: (Only 802.1X) Specifies the certificate thumbprint of the Trusted Root CA.
- AuthMode: (Only 802.1X) Specifies the type of credentials used for authentication. ('machineOrUser', 'machine', 'user', 'guest')
- XmlProfile: The XML representation of the profile.
- ProfileName: The name of the new WiFi profile.
- ConnectionMode: Indicates whether connection to the wireless LAN should be automatic ("auto") or initiated ("manual") by user. The default is "auto".
- Authentication: Specifies the authentication method to be used to connect to the wireless LAN. ('open', 'shared', 'WPA', 'WPAPSK', 'WPA2', 'WPA2PSK', 'WPA3SAE', 'WPA3ENT192', "OWE")
- Encryption: Sets the data encryption to use to connect to the wireless LAN. ('none', 'WEP', 'TKIP', 'AES', 'GCMP256')
- Password: The network key or passpharse of the wireless profile in the form of a secure string.
- ConnectHiddenSSID: Specifies whether the profile can connect to networks which does not broadcast SSID. The default is false.
- EAPType: (Only 802.1X) Specifies the type of 802.1X EAP. You can select "PEAP"(aka MSCHAPv2) or "TLS".
- ServerNames: (Only 802.1X) Specifies the server that will be connect to validate certification.
- TrustedRootCA: (Only 802.1X) Specifies the certificate thumbprint of the Trusted Root CA.
- AuthMode: (Only 802.1X) Specifies the type of credentials used for authentication. ('machineOrUser', 'machine', 'user', 'guest')
- XmlProfile: The XML representation of the profile.
- ProfileName: The name of the profile to be deleted.
- WiFiAdapterName: Specifies the name of the wireless network adapter on the machine. This is used to obtain the Guid of the interface. The default value is 'Wi-Fi'
- WiFiAdapterName: Specifies the name of the wireless network adapter on the machine. This is used to obtain the Guid of the interface. The default value is 'Wi-Fi'
- ProfileName: The name of the profile to be connected.
- ConnectionMode: Specifies the mode of the connection. Valid values are Profile,TemporaryProfile,DiscoveryProfile,DiscoveryUnsecure, and Auto.
- Dot11BssType: A value that indicates the BSS type of the network. If a profile is provided, this BSS type must be the same as the one in the profile.
- WiFiAdapterName: Specifies the name of the wireless network adapter on the machine. This is used to obtain the Guid of the interface. The default value is 'Wi-Fi'
- WiFiAdapterName: Specifies the name of the wireless network adapter on the machine. This is used to obtain the Guid of the interface. The default value is 'Wi-Fi'
PS C:\>Get-WiFiProfile -ProfileName TestWiFi
ProfileName : TestWiFi
ConnectionMode : auto
Authentication : WPA2PSK
Encryption : AES
Password : PS C:\>Get-WiFiProfile -ProfileName TestWiFi -ClearKey
ProfileName : TestWiFi
ConnectionMode : auto
Authentication : WPA2PSK
Encryption : AES
Password : password1PS C:\>Remove-WiFiProfile -ProfileName FreeWifi PS C:\>$password = Read-Host -AsSecureString
**********
PS C:\>Set-WiFiProfile -ProfileName MyNetwork -ConnectionMode auto -Authentication WPA2PSK -Encryption AES -Password $password PS C:\>$templateProfileXML = @"
<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>MyNetwork</name>
<SSIDConfig>
<SSID>
<name>MyNetwork</name>
</SSID>
</SSIDConfig>
<connectionType>ESS</connectionType>
<connectionMode>manual</connectionMode>
<MSM>
<security>
<authEncryption>
<authentication>WPA2PSK</authentication>
<encryption>AES</encryption>
<useOneX>false</useOneX>
</authEncryption>
<sharedKey>
<keyType>passPhrase</keyType>
<protected>false</protected>
<keyMaterial>password1</keyMaterial>
</sharedKey>
</security>
</MSM>
</WLANProfile>
"@
PS C:\>Set-WiFiProfile -XmlProfile $templateProfileXML PS C:\>$password = Read-Host -AsSecureString
**********
PS C:\>New-WiFiProfile -ProfileName MyNetwork -ConnectionMode auto -Authentication WPA2PSK -Encryption AES -Password $password PS C:\>New-WiFiProfile -ProfileName OneXNetwork -ConnectionMode auto -Authentication WPA2 -Encryption AES -EAPType PEAP -TrustedRootCA '041101cca5b336a9c6e50d173489f5929e1b4b00' PS C:\>Get-WiFiAvailableNetwork
SSID RSSI SignalQuality WlanPhyTypes DefaultAuthAlgorithm DefaultCipherAlgorithm ProfileName
---- ---- ------------- ------------ -------------------- ---------------------- -----------
tplink-infra-a -70 dBm 60 % {802.11ac} WPA2-Personal (PSK) CCMP profile-1
-69 dBm 62 % {802.11ax} WPA3-Personal (SAE) CCMP PS C:\>Get-WiFiConnectedNetworkInfo
state : connected
interfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
interfaceGuid : 994655d3-cd01-4148-840f-7321c9f1e708
SSID : testing-wifi-11ax
BSSID : FF-A6-27-F7-94-3A
BssType : Infrastructure
WlanPhyType : 802.11ax
RSSI : -72 #dBm
SignalQuality : 57 #%
ChannelNumber : 112
RxRate : 720 #Mbps
TxRate : 544 #Mbps
AuthAlgorithm : WPA3-Personal (SAE)
CipherAlgorithm : CCMP
WlanConnectionMode : wlan_connection_mode_auto
ProfileName : testing-wifi-11ax PS C:\> $password = Read-Host -AsSecureString
************
PS C:\> New-WiFiProfile -ProfileName MyNetwork -ConnectionMode auto -Authentication WPA2PSK -Encryption AES -Password $password
The operation was successful.
PS C:\> Connect-WiFiProfile -ProfileName MyNetwork- Added Get-WiFiConnectedNetworkInfo
- Added new parameter "AuthMode" to New-WiFiProfile and Set-WiFiProfile
- Added support for IEEE802.11be (aka Wi-Fi 7)
- Added private function Get-WiFiInterface contributed by @jimcroft
- Added Search-WifiNetwork.
- Add support for WPA3 and Wi-Fi Enhanced Open contributed by @mkht.
- Added support for create IEEE 802.1X EAP network profile.
- Added Connect-WiFiProfile. Add new scaffolding.
- Added Get-WiFiAvailableNetwork. Moved code that enables Windows 7 compatibility to a function.
- Added New-WiFiProfile
- Added Set-WiFiProfile
- Added formating
- Initial released with the following functions
- Get-WiFiProfile
- Remove-WiFiProfile