Skip to content

Commit 461d351

Browse files
Merge pull request #33846 from rwestMSFT/rw-0417-fix-420833
Clean up PS script in network protocol article (UUF 420833)
2 parents b3061d4 + 3870445 commit 461d351

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/database-engine/configure-windows/enable-or-disable-a-server-network-protocol.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ All network protocols are installed during installation, by [!INCLUDE[ssNoVersio
6262
You can run this script from any machine, with or without SQL Server installed. Make sure you have the **SqlServer** module installed.
6363

6464
```powershell
65-
#requires the SqlServer module
65+
# This script requires the SqlServer module
6666
Import-Module SQLServer
6767
6868
$wmi = New-Object Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer <#computer_name#>
@@ -76,7 +76,7 @@ All network protocols are installed during installation, by [!INCLUDE[ssNoVersio
7676
$Tcp.IsEnabled = $true
7777
$Tcp.Alter()
7878
$Tcp
79-
79+
8080
# Enable the named pipes protocol for the default instance.
8181
$uri = "ManagedComputer[@Name='<#computer_name#>']/ServerInstance[@Name='MSSQLSERVER']/ServerProtocol[@Name='Np']"
8282
$Np = $wmi.GetSmoObject($uri)
@@ -99,22 +99,31 @@ After you enable or disable protocols, you must stop and restart the [!INCLUDE[s
9999

100100
```powershell
101101
# Get a reference to the ManagedComputer class.
102-
CD SQLSERVER:\SQL\<computer_name>
102+
Set-Location SQLSERVER:\SQL\<computer_name>
103103
$Wmi = (get-item .).ManagedComputer
104+
104105
# Get a reference to the default instance of the Database Engine.
105106
$DfltInstance = $Wmi.Services['MSSQLSERVER']
107+
106108
# Display the state of the service.
107109
$DfltInstance
110+
108111
# Stop the service.
109112
$DfltInstance.Stop();
113+
110114
# Wait until the service has time to stop.
115+
111116
# Refresh the cache.
112117
$DfltInstance.Refresh();
118+
113119
# Display the state of the service.
114120
$DfltInstance
121+
115122
# Start the service again.
116123
$DfltInstance.Start();
124+
117125
# Wait until the service has time to start.
126+
118127
# Refresh the cache and display the state of the service.
119128
$DfltInstance.Refresh();
120129
$DfltInstance

0 commit comments

Comments
 (0)