Monday, April 29, 2019

How to turn off SMB on a Windows 10 installation

A little bit ago I had the need to turn off the SMB service on my Windows 10 installation.


1) How to find what's listening: netstat -n -a | findstr "LISTENING" | findstr ":445".
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING
  TCP           [::]:445                   [::]:0              LISTENING

2) Start a the Windows power shell with administrative privileges ands execute the following.


$netBTParametersPath = "HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\Parameters"
IF(Test-Path -Path $netBTParametersPath) {
    Set-ItemProperty -Path $netBTParametersPath -Name "SMBDeviceEnabled" -Value 0
}
Set-Service lanmanserver -StartupType Disabled
Stop-Service lanmanserver -Force


3) Restart the computer, use the command from 1) to confirm nothing is listening on part 445 anymore.

No comments:

Post a Comment