Automating with PowerShell: Deploying WiFi Profiles

I’m working with one of my collaborators to create scripts for their RMM system and they got a request from one of their clients “Can we add WiFi profiles using PowerShell?” and of course I pointed them to my blog. Only to find to my shame that I never blogged about it.

Adding WiFi profiles is very straight forward when you’re using a domain environment, you simply create a GPO and click around in the settings until you’ve perfected your setup, but in modern styled environments it’s not always that easy, and of course you want to use your RMM system to deploy the correct Wi-Fi Settings to all users.

So, let’s jump into that; today we’re adding a Wifi Connecting that uses a WPA2 PSK with AES encryption – The most commonly used network these days.

The Script

You’ll have to set $SSID and $PSK to your prefered SSID and PSK, remember that the SSID is case sensitive too.

$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="">
	<MacRandomization xmlns="">
"@ | out-file "$($ENV:TEMP)\$guid.SSID"

netsh wlan add profile filename="$($ENV:TEMP)\$guid.SSID" user=all

remove-item "$($ENV:TEMP)\$guid.SSID" -Force

And that’s it! using this script you can deploy Wi-Fi to your clients with relative ease 🙂 As always, Happy PowerShelling.

1 Comment

  1. Michael McCool April 21, 2021 at 4:52 pm

    Here is a Windows 7 compatible version of the XML. If you support Windows 7 devices still, the above will likely not work with them. This XML will work for both Windows 7 and 10.






Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.