Created
June 27, 2017 20:38
-
-
Save anonymous/223c0f48541cf272a1263d0d9e60275b to your computer and use it in GitHub Desktop.
Disable SMB v1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$os = [System.Environment]::OSVersion.VersionString | |
$os = $os -replace '\D+(\d+)','$1' | |
# windows 10 | |
if($os.ToString().StartsWith("10")) | |
{ | |
echo "Windows 10" | |
Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart | |
} | |
# windows 8.1 | |
if ($os.ToString().StartsWith("63")) | |
{ | |
echo "Windows 8.1" | |
Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart | |
} | |
# windows 8 | |
if ($os.ToString().StartsWith("62")) | |
{ | |
echo "Windows 8" | |
Set-SmbServerConfiguration -EnableSMB1Protocol $false | |
sc.exe config lanmanworkstation depend= bowser/mrxsmb20/nsi | |
sc.exe config mrxsmb10 start= disabled | |
} | |
# windows vista | |
if ($os.ToString().StartsWith("60")) | |
{ | |
echo "Windows Vista" | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB1 -Type DWORD -Value 0 -Force | |
sc.exe config lanmanworkstation depend= bowser/mrxsmb20/nsi | |
sc.exe config mrxsmb10 start= disabled | |
} | |
# windows 7 | |
if ($os.ToString().StartsWith("61")) | |
{ | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB1 -Type DWORD -Value 0 -Force | |
sc.exe config lanmanworkstation depend= bowser/mrxsmb20/nsi | |
sc.exe config mrxsmb10 start= disabled | |
} | |
# windows xp | |
if ($os.ToString().StartsWith("5")) | |
{ | |
echo "Windows XP" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment