Add-SqlFirewallRule
Adds a Windows Firewall rule to allow connections to a specific instance of SQL Server.
Sintaxis
ByPath (Es el valor predeterminado).
Add-SqlFirewallRule
[-Credential] <PSCredential>
[-Path <String[]>]
[-AutomaticallyAcceptUntrustedCertificates]
[-ManagementPublicPort <Int32>]
[-RetryTimeout <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByObject
Add-SqlFirewallRule
[-Credential] <PSCredential>
-InputObject <Server[]>
[-AutomaticallyAcceptUntrustedCertificates]
[-ManagementPublicPort <Int32>]
[-RetryTimeout <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByName
Add-SqlFirewallRule
[-Credential] <PSCredential>
-ServerInstance <String[]>
[-AutomaticallyAcceptUntrustedCertificates]
[-ManagementPublicPort <Int32>]
[-RetryTimeout <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Add-SqlFirewallRule cmdlet adds a Windows Firewall rule to allow connections for the specified instance of SQL Server. The SQL Server Cloud Adapter must be running and accessible on the computer that hosts the instance of SQL Server.
This cmdlet supports the following modes of operation:
- Specify the instance Windows PowerShell path.
- Specify the server object.
- Specify the server instance of the target instance of SQL Server.
Note: This cmdlet ceased to work a long time ago. It's been removed in version 22 of the module.
Ejemplos
Example 1: Add a Windows Firewall rule on the local computer
PS C:\> CD SQLSERVER:\SQL\Computer\Instance
PS SQLSERVER:\SQL\Computer\Instance> Add-SqlFirewallRule -Credential $Credential -AcceptSelfSignedCertificate
The first command changes directory to the SQL Server computer instance.
Example 2: Add a Windows Firewall rule on the local computer through a pipe
PS C:\> Get-SqlInstance -Credential $Credential -MachineName "Computer001" | Add-SqlFirewallRule -Credential $Credential -AcceptSelfSignedCertificate
This command gets the SQL Server instance based on the credentials stored in the variable named $Credentials. The command then pipes the SQL Server instances of SQL Server on the computer named 'Computer001'. The command then adds Windows Firewall rules to allow connections for each one of the instances. The self-signed certificate of the target machine is automatically accepted without prompting the user.
Parámetros
-AutomaticallyAcceptUntrustedCertificates
Indicates that this cmdlet automatically accepts untrusted certificates.
Propiedades del parámetro
Tipo: | SwitchParameter |
Valor predeterminado: | None |
Admite caracteres comodín: | False |
DontShow: | False |
Conjuntos de parámetros
(All)
Posición: | Named |
Mandatory: | False |
Valor de la canalización: | False |
Valor de la canalización por nombre de propiedad: | False |
Valor de los argumentos restantes: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
Propiedades del parámetro
Tipo: | SwitchParameter |
Valor predeterminado: | False |
Admite caracteres comodín: | False |
DontShow: | False |
Alias: | cf |
Conjuntos de parámetros
(All)
Posición: | Named |
Mandatory: | False |
Valor de la canalización: | False |
Valor de la canalización por nombre de propiedad: | False |
Valor de los argumentos restantes: | False |
-Credential
Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.
Propiedades del parámetro
Tipo: | PSCredential |
Valor predeterminado: | None |
Admite caracteres comodín: | False |
DontShow: | False |
Conjuntos de parámetros
(All)
Posición: | 0 |
Mandatory: | True |
Valor de la canalización: | False |
Valor de la canalización por nombre de propiedad: | False |
Valor de los argumentos restantes: | False |
-InputObject
Specifies the server object of the target instance of SQL Server.
Propiedades del parámetro
Tipo: | Server[] |
Valor predeterminado: | None |
Admite caracteres comodín: | False |
DontShow: | False |
Conjuntos de parámetros
ByObject
Posición: | Named |
Mandatory: | True |
Valor de la canalización: | True |
Valor de la canalización por nombre de propiedad: | False |
Valor de los argumentos restantes: | False |
-ManagementPublicPort
Specifies the public management port on the target machine. This parameter is used when the ports of the target machine are not directly accessible but are exposed through endpoints, which means that they need to be connected to a different port.
The SQL Server Cloud Adapter must be accessible by this port.
Propiedades del parámetro
Tipo: | Int32 |
Valor predeterminado: | None |
Admite caracteres comodín: | False |
DontShow: | False |
Conjuntos de parámetros
(All)
Posición: | Named |
Mandatory: | False |
Valor de la canalización: | False |
Valor de la canalización por nombre de propiedad: | False |
Valor de los argumentos restantes: | False |
-Path
Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If this parameter is not specified, the value of this parameter defaults to the current working location.
Propiedades del parámetro
Tipo: | String[] |
Valor predeterminado: | None |
Admite caracteres comodín: | False |
DontShow: | False |
Conjuntos de parámetros
ByPath
Posición: | Named |
Mandatory: | False |
Valor de la canalización: | False |
Valor de la canalización por nombre de propiedad: | False |
Valor de los argumentos restantes: | False |
-RetryTimeout
Specifies the time period to retry the command on the target server. After the timeout expires, no retry is attempted.
Propiedades del parámetro
Tipo: | Int32 |
Valor predeterminado: | None |
Admite caracteres comodín: | False |
DontShow: | False |
Conjuntos de parámetros
(All)
Posición: | Named |
Mandatory: | False |
Valor de la canalización: | False |
Valor de la canalización por nombre de propiedad: | False |
Valor de los argumentos restantes: | False |
-ServerInstance
Specifies the name of an instance of SQL Server, as an array, that becomes the target of the operation.
Propiedades del parámetro
Tipo: | String[] |
Valor predeterminado: | None |
Admite caracteres comodín: | False |
DontShow: | False |
Conjuntos de parámetros
ByName
Posición: | Named |
Mandatory: | True |
Valor de la canalización: | True |
Valor de la canalización por nombre de propiedad: | True |
Valor de los argumentos restantes: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
Propiedades del parámetro
Tipo: | SwitchParameter |
Valor predeterminado: | False |
Admite caracteres comodín: | False |
DontShow: | False |
Alias: | wi |
Conjuntos de parámetros
(All)
Posición: | Named |
Mandatory: | False |
Valor de la canalización: | False |
Valor de la canalización por nombre de propiedad: | False |
Valor de los argumentos restantes: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Entradas
Microsoft.SqlServer.Management.Smo.Server
System.String[]