Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- Disable SMBv1 protocol
- #>
- #Command to disable SMBv1
- # Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force
- <# Commands below are grouped by operating system and first disable the SMBV1 protocol and then
- verify that it's set by verifying it's set to false
- Also note that the dnshostname might be blank in some instances, so can either select the entire
- object or select the name from the Get-adcomputer command
- Add Filters as needed to the get-adcomputer command
- #>
- # for Server 2012 and Server 2012R2
- get-adcomputer -Filter * -Property *|
- Where-object {$_.OperatingSystem -like "*2012*"}|
- select DNSHostname|
- foreach-object{Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force}
- get-adcomputer -Filter * -Property *|
- Where-object {$_.OperatingSystem -like "*2012*"}|
- select DNSHostname|foreach-object{(get-smbserverconfiguration).EnableSMB1Protocol}
- # Server 2008 and 2008R2
- get-adcomputer -Filter * -Property *|
- Where-object {$_.OperatingSystem -like "*2008*"}|
- select DNSHostname|
- foreach-object{Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force}
- get-adcomputer -Filter * -Property *|
- Where-object {$_.OperatingSystem -like "*2008*"}|
- select DNSHostname|foreach-object{(get-smbserverconfiguration).EnableSMB1Protocol}
- # Non-Server Operating Systems
- get-adcomputer -Filter * -Property *|
- Where-object {$_.OperatingSystem -notlike "*server*"}|
- select DNSHostname|
- foreach-object{Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force}
- get-adcomputer -Filter * -Property *|
- Where-object {$_.OperatingSystem -notlike "*server*"}|
- select DNSHostname|foreach-object{(get-smbserverconfiguration).EnableSMB1Protocol}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement