Auto-Remove WLAN Profiles

This script removes all saved WLAN profiles when the computer starts.

Script Content

# Define the batch command
$batchCommand = 'netsh wlan delete profile name="*"'

# File path for the .cmd file
$filePath = "C:\Windows\System32\WLAN-Profiles.cmd"

# Write the batch command to the .cmd file
$batchCommand | Out-File -FilePath $filePath -Encoding ASCII

Write-Host "The .cmd file was successfully created: $filePath"

Set-ExecutionPolicy Unrestricted

# Create a scheduled task to run the CMD script at logon
$taskAction = New-ScheduledTaskAction -Execute "C:\Windows\System32\WLAN-Profiles.cmd"
$taskTrigger = New-ScheduledTaskTrigger -AtLogOn
$taskName = "DeleteWLANProfiles"

Register-ScheduledTask -Action $taskAction -Trigger $taskTrigger -TaskName $taskName

Set-ExecutionPolicy Restricted

Notes

  • This script creates a .cmd file that deletes all WLAN profiles.

  • It is triggered automatically through a scheduled task at user logon.

Batch Script to use manually

Last updated