-
Notifications
You must be signed in to change notification settings - Fork 227
SqlProtocol
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
| InstanceName | Key | String | Specifies the name of the SQL Server instance to enable the protocol for. | |
| ProtocolName | Key | String | Specifies the name of network protocol to be configured. |
SharedMemory, NamedPipes, TcpIp
|
| Enabled | Write | Boolean | Specifies if the protocol should be enabled or disabled. | |
| KeepAlive | Write | SInt32 | Specifies the keep alive duration in milliseconds. Only used for the TCP/IP protocol, ignored for all other protocols. | |
| ListenOnAllIpAddresses | Write | Boolean | Specifies to listen on all IP addresses. Only used for the TCP/IP protocol, ignored for all other protocols. | |
| PipeName | Write | String | Specifies the name of the named pipe. Only used for the Named Pipes protocol, ignored for all other protocols. | |
| RestartTimeout | Write | UInt16 | Timeout value for restarting the SQL Server services. The default value is 120 seconds. |
|
| ServerName | Write | String | Specifies the host name of the SQL Server to be configured. If the SQL Server belongs to a cluster or availability group specify the host name for the listener or cluster group. Default value is the current computer name. | |
| SuppressRestart | Write | Boolean | If set to $true then the any attempt by the resource to restart the service is suppressed. The default value is $false. |
|
| HasMultiIPAddresses | Read | Boolean | Returns $true or $false whether the instance has multiple IP addresses or not. |
The SqlProtocol DSC resource manages the SQL Server protocols
for a SQL Server instance.
For more information about protocol properties look at the following articles:
- Target machine must be running Windows Server 2012 or later.
- Target machine must be running SQL Server Database Engine 2012 or later.
- Target machine must have access to the SQLPS PowerShell module or the SqlServer PowerShell module.
- If a protocol is disabled that prevents the cmdlet
Restart-SqlServicefrom contacting the instance to evaluate if it is a cluster. If this is the case then the parameterSuppressRestartmust be used to override the restart. It is the same if a protocol is enabled that was previously disabled and no other protocol allows connecting to the instance, then the parameterSuppressRestartmust also be used. - When connecting to a Failover Cluster where the account
SYSTEMdoes not have access then the correct credential must be provided in the built-in parameterPSDscRunAsCredential. If not the following error can appear;An internal error occurred. - When using the resource against an SQL Server 2022 instance, the module SqlServer v22.0.49-preview or newer must be installed.
All issues are not listed here, see here for all open issues.
This example will enable the TCP/IP protocol, set the protocol to listen on all IP addresses, and set the keep alive duration.
The resource will be run as the account provided in $SystemAdministratorAccount.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SystemAdministratorAccount
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlProtocol 'ChangeTcpIpOnDefaultInstance'
{
InstanceName = 'MSSQLSERVER'
ProtocolName = 'TcpIp'
Enabled = $true
ListenOnAllIpAddresses = $false
KeepAlive = 20000
PsDscRunAsCredential = $SystemAdministratorAccount
}
}
}This example will enable the Named Pipes protocol and set the name of the pipe.
The resource will be run as the account provided in $SystemAdministratorAccount.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SystemAdministratorAccount
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlProtocol 'ChangeTcpIpOnDefaultInstance'
{
InstanceName = 'MSSQLSERVER'
ProtocolName = 'NamedPipes'
Enabled = $true
PipeName = '\\.\pipe\$$\TESTCLU01A\MSSQL$SQL2014\sql\query'
PsDscRunAsCredential = $SystemAdministratorAccount
}
}
}This example will enable the Shared Memory protocol.
The resource will be run as the account provided in $SystemAdministratorAccount.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SystemAdministratorAccount
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlProtocol 'ChangeTcpIpOnDefaultInstance'
{
InstanceName = 'MSSQLSERVER'
ProtocolName = 'SharedMemory'
Enabled = $true
PsDscRunAsCredential = $SystemAdministratorAccount
}
}
}This example will disable the TCP/IP protocol.
The resource will be run as the account provided in $SystemAdministratorAccount.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SystemAdministratorAccount
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlProtocol 'ChangeTcpIpOnDefaultInstance'
{
InstanceName = 'MSSQLSERVER'
ProtocolName = 'TcpIp'
Enabled = $false
PsDscRunAsCredential = $SystemAdministratorAccount
}
}
}This example will disable the Named Pipes protocol.
The resource will be run as the account provided in $SystemAdministratorAccount.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SystemAdministratorAccount
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlProtocol 'ChangeTcpIpOnDefaultInstance'
{
InstanceName = 'MSSQLSERVER'
ProtocolName = 'NamedPipes'
Enabled = $false
PsDscRunAsCredential = $SystemAdministratorAccount
}
}
}This example will disable the Shared Memory protocol.
The resource will be run as the account provided in $SystemAdministratorAccount.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SystemAdministratorAccount
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlProtocol 'ChangeTcpIpOnDefaultInstance'
{
InstanceName = 'MSSQLSERVER'
ProtocolName = 'SharedMemory'
Enabled = $false
PsDscRunAsCredential = $SystemAdministratorAccount
}
}
}- Add-SqlDscFileGroup
- Add-SqlDscNode
- Add-SqlDscTraceFlag
- Assert-SqlDscAgentOperator
- Assert-SqlDscLogin
- Backup-SqlDscDatabase
- Complete-SqlDscFailoverCluster
- Complete-SqlDscImage
- Connect-SqlDscDatabaseEngine
- ConvertFrom-SqlDscDatabasePermission
- ConvertFrom-SqlDscServerPermission
- ConvertTo-SqlDscDatabasePermission
- ConvertTo-SqlDscDataFile
- ConvertTo-SqlDscEditionName
- ConvertTo-SqlDscFileGroup
- ConvertTo-SqlDscServerPermission
- Deny-SqlDscServerPermission
- Disable-SqlDscAgentOperator
- Disable-SqlDscAudit
- Disable-SqlDscDatabaseSnapshotIsolation
- Disable-SqlDscLogin
- Disconnect-SqlDscDatabaseEngine
- Enable-SqlDscAgentOperator
- Enable-SqlDscAudit
- Enable-SqlDscDatabaseSnapshotIsolation
- Enable-SqlDscLogin
- Get-SqlDscAgentAlert
- Get-SqlDscAgentOperator
- Get-SqlDscAudit
- Get-SqlDscBackupFileList
- Get-SqlDscCompatibilityLevel
- Get-SqlDscConfigurationOption
- Get-SqlDscDatabase
- Get-SqlDscDatabasePermission
- Get-SqlDscDateTime
- Get-SqlDscInstalledInstance
- Get-SqlDscLogin
- Get-SqlDscManagedComputer
- Get-SqlDscManagedComputerInstance
- Get-SqlDscManagedComputerService
- Get-SqlDscPreferredModule
- Get-SqlDscRole
- Get-SqlDscRSPackage
- Get-SqlDscRSSetupConfiguration
- Get-SqlDscServerPermission
- Get-SqlDscServerProtocol
- Get-SqlDscServerProtocolName
- Get-SqlDscServerProtocolTcpIp
- Get-SqlDscSetupLog
- Get-SqlDscStartupParameter
- Get-SqlDscTraceFlag
- Grant-SqlDscServerPermission
- Import-SqlDscPreferredModule
- Initialize-SqlDscRebuildDatabase
- Install-SqlDscPowerBIReportServer
- Install-SqlDscReportingService
- Install-SqlDscServer
- Invoke-SqlDscQuery
- Invoke-SqlDscScalarQuery
- New-SqlDscAgentAlert
- New-SqlDscAgentOperator
- New-SqlDscAudit
- New-SqlDscDatabase
- New-SqlDscDatabaseSnapshot
- New-SqlDscDataFile
- New-SqlDscFileGroup
- New-SqlDscLogin
- New-SqlDscRole
- Remove-SqlDscAgentAlert
- Remove-SqlDscAgentOperator
- Remove-SqlDscAudit
- Remove-SqlDscDatabase
- Remove-SqlDscLogin
- Remove-SqlDscNode
- Remove-SqlDscRole
- Remove-SqlDscTraceFlag
- Repair-SqlDscPowerBIReportServer
- Repair-SqlDscReportingService
- Repair-SqlDscServer
- Restore-SqlDscDatabase
- Resume-SqlDscDatabase
- Revoke-SqlDscServerPermission
- Save-SqlDscSqlServerMediaFile
- Set-SqlDscAgentAlert
- Set-SqlDscAgentOperator
- Set-SqlDscAudit
- Set-SqlDscConfigurationOption
- Set-SqlDscDatabaseDefault
- Set-SqlDscDatabaseOwner
- Set-SqlDscDatabasePermission
- Set-SqlDscDatabaseProperty
- Set-SqlDscServerPermission
- Set-SqlDscStartupParameter
- Set-SqlDscTraceFlag
- Suspend-SqlDscDatabase
- Test-SqlDscAgentAlertProperty
- Test-SqlDscBackupFile
- Test-SqlDscConfigurationOption
- Test-SqlDscDatabaseProperty
- Test-SqlDscIsAgentAlert
- Test-SqlDscIsAgentOperator
- Test-SqlDscIsDatabase
- Test-SqlDscIsDatabasePrincipal
- Test-SqlDscIsLogin
- Test-SqlDscIsLoginEnabled
- Test-SqlDscIsRole
- Test-SqlDscIsSupportedFeature
- Test-SqlDscRSInstalled
- Test-SqlDscServerPermission
- Uninstall-SqlDscPowerBIReportServer
- Uninstall-SqlDscReportingService
- Uninstall-SqlDscServer
- SqlAG
- SqlAGDatabase
- SqlAgentAlert
- SqlAgentFailsafe
- SqlAgentOperator
- SqlAGListener
- SqlAGReplica
- SqlAlias
- SqlAlwaysOnService
- SqlAudit
- SqlConfiguration
- SqlDatabase
- SqlDatabaseDefaultLocation
- SqlDatabaseMail
- SqlDatabaseObjectPermission
- SqlDatabasePermission
- SqlDatabaseRole
- SqlDatabaseUser
- SqlEndpoint
- SqlEndpointPermission
- SqlLogin
- SqlMaxDop
- SqlMemory
- SqlPermission
- SqlProtocol
- SqlProtocolTcpIp
- SqlReplication
- SqlRole
- SqlRS
- SqlRSSetup
- SqlScript
- SqlScriptQuery
- SqlSecureConnection
- SqlServiceAccount
- SqlSetup
- SqlTraceFlag
- SqlWaitForAG
- SqlWindowsFirewall