WannaCry prevention notes

Few useful PowerShell commands:

Set-SmbServerConfiguration -EnableSMB1Protocol $false - disables smb1

Win7 and earlier: PS v2

Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB1 -Type DWORD -Value 0 -Force

or to do it via the registry:
To enable or disable SMBv1 on the SMB server, configure the following registry key:
Registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\ParametersRegistry entry: SMB1
REG_DWORD: 0 = Disabled
REG_DWORD: 1 = Enabled
Default: 1 = Enabled

To check SMB version:

PS C:\> Get-SmbConnection

ServerName ShareName UserName Credential Dialect NumOpens
---------- --------- -------- ---------- ------- --------
smb media domain\administrator domain\Administrator 3.00 2

Microsoft source: here


Linux Samba
To disable samba 1 add the following line to the [global] section of the /etc/samba/smb.conf

min protocol = SMB2

then restart the samba service