Author | Andreas Jordan (@JordanOrdix), ordix.de |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Remove-DbaFirewallRule on GitHub.
Want to see the Bill Of Health for this command? Check out Remove-DbaFirewallRule.
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.
Alias | |
Required | True |
Pipeline | false |
Default Value |
The output object(s) from Get-DbaFirewallRule.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Credential object used to connect to the Computer as a different user.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Removes firewall rules for the given type(s).
Valid values are:
Alias | |
Required | False |
Pipeline | false |
Default Value | @('Engine', 'DAC') |
Accepted Values | Engine,Browser,DAC,AllInstance |
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.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
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.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |