How to close 445/137/138/139 port on Windows

Prevent WannaCry

Due to large-scale worm struck, the most urgent thing is to close windows 445/137/138/139 port, where several options to share the windows closed 445/137/138/139 port for Window2003/XP/Windows 7/Windows 8/Windows 10 system.

Modify the registry 

Add a registry key, specific steps:

  • Click “Start”, “Run”, type “regedit” to open the registry.
  • Locate the registry key “HKEY_LOCAL_MACHINE\System\Controlset\Services\NetBT\Parameters”
  • Select “Parameters” New Right “DWORD Value.”
  • Rename the DWORD value as “SMBDeviceEnabled”
  • Right-click “SMBDeviceEnabled” select “Edit” in the “numerical data”, “0”

Key details are as follows:

Hive: HKEY_LOCAL_MACHINE

Key: System\CurrentControlSet\Services\NetBT\Parameters
Name: SMBDeviceEnabled
Type: REG_DWORD
Value: 0

 

 

After completion modify the registry to restart the computer, and then CMD run “netstat -an | findstr 445” viewport 445 is closed.

Configure the firewall

This method is not shut itself down port 445 but in order to block access to the external port 445 connected to the machine.

Firewall Advanced Settings – Inbound rules – Right-click New Rule – Select UDP, the port number in the dialog box to write 445.

Shut down the server service

Administrator, open cmd, run

net stop server

You need to restart your computer.

Disable SMBv1