All Tweaks

Firewall & Security

Block SMB Port 445

Block incoming SMB traffic on port 445 to prevent ransomware attacks

Benefit

Significantly improves security by blocking major attack vector for ransomware and worms

Impact

high

Commands (1)

Run these commands in an elevated PowerShell window (Run as Administrator). This is exactly what CodeWinOptimizer executes for this tweak.

$ErrorActionPreference='Continue'; $name = 'CodeWinOpt-Block-SMB-445'; $r = Get-NetFirewallRule -DisplayName $name -ErrorAction SilentlyContinue; if ($r) { Write-Host "[OK] Rule '$name' already exists" } else { try { New-NetFirewallRule -DisplayName $name -Direction Inbound -Action Block -Protocol TCP -LocalPort 445 -Profile Any -Description 'Block inbound SMB on port 445 (CodeWinOptimizer)' -ErrorAction Stop | Out-Null; Write-Host "[OK] Created firewall rule '$name' blocking inbound TCP 445" } catch { Write-Host "[ERR] $($_.Exception.Message)" } }

Warnings

  • Port 445 is the primary vector for ransomware propagation on Windows networks. Blocking is highly recommended unless you require SMB shares.

How to revert this tweak

  • In CodeWinOptimizer: disable the tweak again — the app restores the original values it recorded when it was applied.
  • Manually: reverse the change — re-enable the service, delete the registry value you created, or restore the previous value shown when you ran the commands.
  • With System Restore: press Win + R, run rstrui, and select the restore point that was created before the change.

Frequently asked questions

Do I need to restart?

Some changes apply immediately (many registry and network values). Others — services, GPU scheduling, power settings — only take full effect after signing out or restarting. If the change seems to have no effect, restart before troubleshooting.

Will it survive Windows updates?

Most values persist, but major Windows feature updates can reset policies, services and scheduled tasks. After a big update, come back to this page and re-check the tweak — the app also shows the current state before applying anything.

Is it reversible?

Yes, but this is a high-impact tweak: create a system restore point before applying it. You can revert it from CodeWinOptimizer (which records the original values), by restoring the previous values manually, or with System Restore.

Can I apply it manually?

Yes — every command listed above is exactly what the app runs. Open PowerShell as Administrator and run them one at a time, checking the output. For a guided flow with a restore point and one-click revert, use the app.

Related tweaks