gwendes Posted May 30, 2025 Posted May 30, 2025 I've pushed out our new wifi settings with a Powershell script which adds the new network and deletes the old one (which is due to be turned off) Only problem is that computers don't 'Connect automatically' to the new network, users need to select that toggle. Anyone know of a way to force this? (I can't use the GPO because WPA3 isn't supported on Server 2016)
Chuckster Posted May 30, 2025 Posted May 30, 2025 Share your PS script so we can see what is or isn't working with it.
gwendes Posted June 2, 2025 Author Posted June 2, 2025 param( [string]$SSID="school ssid", [string]$PSK="long key" ) $guid = New-Guid $HexArray = $ssid.ToCharArray() | foreach-object { [System.String]::Format("{0:X}", [System.Convert]::ToUInt32($_)) } $HexSSID = $HexArray -join "" @" <?xml version="1.0"?> <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> <name>$($SSID)</name> <SSIDConfig> <SSID> <hex>$($HexSSID)</hex> <name>$($SSID)</name> </SSID> </SSIDConfig> <connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <MSM> <security> <authEncryption> <authentication>WPA2PSK</authentication> <encryption>AES</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>passPhrase</keyType> <protected>false</protected> <keyMaterial>$($PSK)</keyMaterial> </sharedKey> </security> </MSM> <MacRandomization xmlns="http://www.microsoft.com/networking/WLAN/profile/v3"> <enableRandomization>false</enableRandomization> <randomizationSeed>1451755948</randomizationSeed> </MacRandomization> </WLANProfile> "@ | out-file "$($ENV:TEMP)\$guid.SSID" netsh wlan add profile filename="$($ENV:TEMP)\$guid.SSID" user=all remove-item "$($ENV:TEMP)\$guid.SSID" -Force
mrstrong Posted June 2, 2025 Posted June 2, 2025 is the delete of old profile done somewhere else as can't see a delete in that script ? could you try adding: netsh wlan connect name="$($SSID)" 1
gwendes Posted June 2, 2025 Author Posted June 2, 2025 Sorry, I posted my previous version, but that worked great. Thanks!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now