Public/Remove-WLANNetwork.ps1
Function Remove-WLANNetwork { <# .SYNOPSIS Removes a WLAN Profile from the computer. .DESCRIPTION Removes a WLAN Profile from the computer. .PARAMETER SSID The SSID .INPUTS System.String .EXAMPLE Remove-WLANNetwork -SSID "SomeSSID" .LINK about_functions_advanced .LINK about_CommonParameters #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Medium" )] [OutputType('System.String')] Param( [Parameter( Mandatory = $true, ValueFromPipeline = $true, HelpMessage = "The SSID" )] [String]$SSID ) Begin { } Process { If ($PSCmdlet.ShouldProcess($SSID, "Remove WLAN Profile from computer")) { $runCMD = netsh wlan delete profile name=$SSID If ($runCMD -notmatch "Profile `"$SSID`" is deleted from interface") { Throw $runCMD } Return $runCMD } } End { } } |