Observação
O acesso a essa página exige autorização. Você pode tentar entrar ou alterar diretórios.
O acesso a essa página exige autorização. Você pode tentar alterar os diretórios.
Observação
Há dois módulos do SQL Server PowerShell; SqlServer e SQLPS.
O módulo SqlServer é o módulo atual do PowerShell a ser usado.
O módulo SQLPS está incluído na instalação do SQL Server (para compatibilidade com versões anteriores), mas não está mais sendo atualizado.
O módulo do SqlServer contém versões atualizadas dos cmdlets no SQLPS e inclui novos cmdlets para dar suporte aos recursos mais recentes do SQL.
Instale o módulo SqlServer da Galeria do PowerShell.
Para obter mais informações, visite o SQL Server PowerShell.
Para habilitar o protocolo TCP quando conectado ao console com SQLPS.
Abra um prompt de comando e digite:
C:\> SQLPS.EXEDica
Se o SQLPS não for encontrado, talvez seja necessário abrir um novo prompt de comando ou apenas fazer logoff e fazer logon novamente.
No prompt de comando do PowerShell, digite:
# Instantiate a ManagedComputer object that exposes primitives to control the # Installation of SQL Server on this machine. $wmi = New-Object 'Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer' localhost # Enable the TCP protocol on the default instance. If the instance is named, # replace MSSQLSERVER with the instance name in the following line. $tcp = $wmi.ServerInstances['MSSQLSERVER'].ServerProtocols['Tcp'] $tcp.IsEnabled = $true $tcp.Alter() # You need to restart SQL Server for the change to persist # -Force takes care of any dependent services, like SQL Agent. # Note: If the instance is named, replace MSSQLSERVER with MSSQL$ followed by # the name of the instance (e.g., MSSQL$MYINSTANCE) Restart-Service -Name MSSQLSERVER -Force
Habilitar o protocolo TCP quando conectado ao console, mas não usando SQLPS
Abra um prompt de comando e digite:
C:\> PowerShell.exeNo prompt de comando do PowerShell, digite:
# Get access to SqlWmiManagement DLL on the machine with SQL # we are on, which is where SQL Server was installed. # Note: This is installed in the GAC by SQL Server Setup. [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SqlWmiManagement') # Instantiate a ManagedComputer object that exposes primitives to control the # Installation of SQL Server on this machine. $wmi = New-Object 'Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer' localhost # Enable the TCP protocol on the default instance. If the instance is named, # replace MSSQLSERVER with the instance name in the following line. $tcp = $wmi.ServerInstances['MSSQLSERVER'].ServerProtocols['Tcp'] $tcp.IsEnabled = $true $tcp.Alter() # You need to restart SQL Server for the change to persist # -Force takes care of any dependent services, like SQL Agent. # Note: If the instance is named, replace MSSQLSERVER with MSSQL$ followed by # the name of the instance (e.g., MSSQL$MYINSTANCE) Restart-Service -Name MSSQLSERVER -Force