Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Powershell DSC to remove SMBv1 support
#requires -Version 4.0 -Modules PSDesiredStateConfiguration
<#
Work on any modern Microsoft Server OS
#>
# change this to any existing Path
$WorkPath = 'C:\scripts'
configuration RemoveSMB1 {
param([string[]]$ComputerName = 'localhost')
Import-DscResource -ModuleName PSDesiredStateConfiguration
Node $ComputerName {
# Removes SMBv1 support, if installed (enforced)
WindowsFeature 'SMB1' {
Name = 'FS-SMB1'
Ensure = 'Absent'
}
}
}
RemoveSMB1 -OutputPath $WorkPath
Start-DscConfiguration -Wait -Path $WorkPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment