Solution in Win 11/Win 10 all versions
If you're looking for a more custom solution, you can deploy a PowerShell Script via Intune to disable or block SMB ports.
Firstly Go to Windows-Powershell Scripts-then Add these scripts
- Disable SMBv1, SMBv2, and SMBv3 protocols (Optional)
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force
Set-SmbServerConfiguration -EnableSMB2Protocol $false -Force
2 . Block SMB port (445)in Windows Firewall
New-NetFirewallRule -DisplayName "Block SMB Port 445" -Direction Inbound -Protocol TCP -LocalPort 445 -Action Block