02: How to import a WLAN / 802.11 / Wireless profile from Dropbox using PolicyPak Scripts Manager
- From an elevated PowerShell prompt on a machine where the WiFi profile is setup and working run the following to show all WLAN profiles on the PC:
netsh wlan show profiles
- Export the profile you need by running the command below - substituting values relevant to your WiFi settings/Environment
netsh wlan export profile name="Company WiFi " key=clear folder=c:\temp
- Note: This means the XML file will contain your WiFi password in clear text, this KB uses Dropbox for demonstration purposes only. It is NOT recommended to store your WLAN profile on the internet.
- Copy the
C:\temp\"Company WiFi.xml" to Dropbox, then create a Share link. Copy the link address, then replace the www.dropbox.com in your shared link with dl.dropboxusercontent.com to get a direct download link. Link should look similar to below:
- Create the WLAN GPO and apply it to the OU where the Computers live, next use PolicyPak Scripts Manager > on the Computer side to create a new policy item
- At the “Specify policy target screen be sure to use switched mode for the policy.
- For the Apply action use the script below (remember to use the PowerShell Script option from the drop down).
start-transcript -path "c:\temp\wlan\install.log"
# Set Download variables
$WLANDownloadFolder = "c:\temp\wlan"
#To get a direct download link replace the www.dropbox.com in your shared link with dl.dropboxusercontent.com
$WLANDownloadURL = "https://dl.dropboxusercontent.com/s/giyj5ei7b3ggyt2/CompanyWiFi.xml?dl=0"
$WLANLocalDownloadLocation = "c:\temp\wlan"
$WLANLocalDownloadFile = "c:\temp\wlan\CompanyWiFi.xml"
# Create WLAN folder if not already there
New-Item -ItemType directory -Path $WLANDownloadFolder
start-transcript -path "c:\temp\wlan\install.log" -append
# Download WLAN Profile XML File
If ((Test-Path $WLANLocalDownloadFile -PathType Leaf) -eq $False)
Invoke-WebRequest -Uri $WLANDownloadURL -OutFile $WLANLocalDownloadFile
#Apply WLAN profile
netsh wlan add profile filename="c:\temp\wlan\CompanyWiFi.xml" user=all
- Verify that "Run script as user" check box is checked, then click next.
- For the "Policy process mode configuration" screen specify "Once or when forced", then click save.
Note: The same policy will work if applied to user side and user OU as well.
Tip: If needed you can delete this WLAN profile from a computer using an elevated PowerShell command prompt.
netsh wlan delete profile name="Company WiFi"