Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By : Donabel Santos
Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By: Donabel Santos

Overview of this book

Table of Contents (21 chapters)
SQL Server 2014 with PowerShell v5 Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Enabling TCP and named pipes in SQL Server


In this recipe, we will enable two network protocols in SQL Server.

Getting ready

For this recipe, we will execute the code on each of the nodes, both local and remote, that will participate in the AlwaysOn configuration.

To do this, we must first ensure that PSRemoting is turned on in every node. Log in to each of the nodes, launch PowerShell or PowerShell ISE as an administrator, and enable remoting using the following script:

Enable-PSRemoting -Force

In addition, check the currently enabled protocols in SQL Server. You can go to SQL Server Configuration Manager and check these protocols from the SQL Server Network Configuration node. By default, Named Pipes and TCP/IP are disabled:

You can also do this check from PowerShell:

[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO')
$instanceName = "SQL01"
$server = New-Object Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName

#check TCP
$server.TcpEnabled

#check...