|Author||Andreas Jordan (@JordanOrdix), ordix.de|
Removes firewall rules for SQL Server instances from the target computer.
Removes firewall rules for SQL Server instances from the target computer. As the group and the names of the firewall rules are fixed, this command only works for rules created with New-DbaFirewallRule.
This is basically a wrapper around Remove-NetFirewallRule executed at the target computer. So this only works if Remove-NetFirewallRule works on the target computer.
The functionality is currently limited. Help to extend the functionality is welcome.
As long as you can read this note here, there may be breaking changes in future versions. So please review your scripts using this command after updating dbatools.
Remove-DbaFirewallRule [-SqlInstance] <DbaInstanceParameter> [-Credential <PSCredential>] [-Type <String>] [-EnableException] [-WhatIf] [-Confirm] [<CommonParameters>] Remove-DbaFirewallRule -InputObject <Object> [-EnableException] [-WhatIf] [-Confirm] [<CommonParameters>]
PS C:\> Remove-DbaFirewallRule -SqlInstance SRV1
Removes the firewall rule for the default instance on SRV1.
PS C:\> Remove-DbaFirewallRule -SqlInstance SRV1\SQL2016 -Type Engine, Browser
Removes the firewall rule for the instance SQL2016 on SRV1 and the firewall rule for the SQL Server Browser.
PS C:\> Get-DbaFirewallRule -SqlInstance SRV1 -Type AllInstance | Where-Object Type -eq 'Engine' | Remove-DbaFirewallRule
Removes the firewall rules for all instance from SRV1. Leaves the firewall rule for the SQL Server Browser in place.
PS C:\> Remove-DbaFirewallRule -SqlInstance SRV1 -Confirm:$false
Removes the firewall rule for the default instance on SRV1. Does not prompt for confirmation.
The target SQL Server instance or instances.
The output object(s) from Get-DbaFirewallRule.
Credential object used to connect to the Computer as a different user.
Removes firewall rules for the given type(s).
Valid values are:
Engine - for the SQL Server instance
Browser - for the SQL Server Browser
AllInstance - for all firewall rules on the target computer related to SQL Server
The default is 'Engine'.
As the Browser might be needed by other instances, the firewall rule for the SQL Server Browser is
never removed with the firewall rule of the instance but only removed if 'Browser' is used.
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.