Поделиться через


Set-SqlNetworkConfiguration

Sets the network configuration of the target instance of SQL Server.

Синтаксис

ByPath (по умолчанию)

Set-SqlNetworkConfiguration
    [-Protocol] <Protocols>
    [[-Port] <Int32>]
    [-Credential] <PSCredential>
    [-Disable]
    [-ForceServiceRestart]
    [-NoServiceRestart]
    [-Path <String[]>]
    [-AutomaticallyAcceptUntrustedCertificates]
    [-ManagementPublicPort <Int32>]
    [-RetryTimeout <Int32>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByObject

Set-SqlNetworkConfiguration
    [-Protocol] <Protocols>
    [[-Port] <Int32>]
    [-Credential] <PSCredential>
    -InputObject <Server[]>
    [-Disable]
    [-ForceServiceRestart]
    [-NoServiceRestart]
    [-AutomaticallyAcceptUntrustedCertificates]
    [-ManagementPublicPort <Int32>]
    [-RetryTimeout <Int32>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByName

Set-SqlNetworkConfiguration
    [-Protocol] <Protocols>
    [[-Port] <Int32>]
    [-Credential] <PSCredential>
    -ServerInstance <String[]>
    [-Disable]
    [-ForceServiceRestart]
    [-NoServiceRestart]
    [-AutomaticallyAcceptUntrustedCertificates]
    [-ManagementPublicPort <Int32>]
    [-RetryTimeout <Int32>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Описание

The Set-SqlNetworkConfiguration cmdlet sets the network configuration of the target instance of SQL Server.

SQL Server Cloud Adapter must be running and accessible on the machine that hosts the instance of SQL Server.

This cmdlet supports the following modes of operation:

  • Specify the instance of the Windows PowerShell path.
  • Specify the server object.
  • Specify the ServerInstance object 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.

Примеры

Example 1: Set the network configuration of the target SQL Server

PS C:\> CD SQLSERVER:\SQL\Computer\Instance
PS SQLSERVER:\SQL\Computer\Instance> Set-SqlNetworkConfiguration -Credential $credential -Protocol TCP -Port 1433 -NoServiceRestart -AcceptSelfSignedCertificate

The first command changes the directory to SQLSERVER:\SQL\Computer\Instance. The second command sets the network configuration to accept TCP connections at port 1433 for the server instance named Computer\Instance. The current working directory is used to determine the server instance where the operation occurs. The SQL Server service is not restarted automatically. The self-signed certificate of the target machine is automatically accepted without prompting the user.

Example 2: Set the network configuration of the target SQL Server using the pipeline

PS C:\> Get-SqlInstance -Credential $Credential -MachineName "Computer006" | Set-SqlNetworkConfiguration -Credential $Credential -Protocol TCP -Disable -NoServiceRestart -AcceptSelfSignedCertificate;

This command gets all instances of SQL Server on the computer named Computer006 and disables TCP connections for each one of them. The SQL Server service is not restarted automatically. The self-signed certificate of the target machine is automatically accepted without prompting the user.

Параметры

-AutomaticallyAcceptUntrustedCertificates

Indicates that this cmdlet automatically accepts untrusted certificates.

Свойства параметра

Тип:SwitchParameter
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Свойства параметра

Тип:SwitchParameter
Default value:False
Поддерживаются подстановочные знаки:False
DontShow:False
Aliases:cf

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Credential

Specifies a user account with Windows Administrator credentials on the target computer.

Свойства параметра

Тип:PSCredential
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:0
Обязательно:True
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Disable

Indicates that this cmdlet disables the specified network protocol on the target instance of SQL Server.

Свойства параметра

Тип:SwitchParameter
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-ForceServiceRestart

Indicates that this cmdlet forces the SQL Server service to restart, if necessary, without prompting the user.

Свойства параметра

Тип:SwitchParameter
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-InputObject

Specifies an array of server objects of the target instance.

Свойства параметра

Тип:

Server[]

Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByObject
Position:Named
Обязательно:True
Значение из конвейера:True
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-ManagementPublicPort

Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.

SQL Server Cloud Adapter must be accessible by this port.

Свойства параметра

Тип:Int32
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-NoServiceRestart

Indicates that this cmdlet prevents a restart of the SQL Server service without prompting the user.

Свойства параметра

Тип:SwitchParameter
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Path

Specifies the path, as an array, to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.

Свойства параметра

Тип:

String[]

Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByPath
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Port

Specifies the port to accept TCP connections. To configure dynamic ports, this parameter should be set to zero.

Свойства параметра

Тип:Int32
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:2
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Protocol

Specifies the network protocol that we want to configure on the target instance of SQL Server.

Свойства параметра

Тип:Protocols
Default value:None
Допустимые значения:TCP
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:1
Обязательно:True
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-RetryTimeout

Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.

Свойства параметра

Тип:Int32
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-ServerInstance

Specifies the name of an instance, as an array, of SQL Server that becomes the target of the operation.

Свойства параметра

Тип:

String[]

Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByName
Position:Named
Обязательно:True
Значение из конвейера:True
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Свойства параметра

Тип:SwitchParameter
Default value:False
Поддерживаются подстановочные знаки:False
DontShow:False
Aliases:wi

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов: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.

Входные данные

Microsoft.SqlServer.Management.Smo.Server

System.String