Skip to content

Instantly share code, notes, and snippets.

@zaneGittins
Created April 29, 2021 20:27
Show Gist options
  • Save zaneGittins/8bd21da866f7accf291329e7269b0009 to your computer and use it in GitHub Desktop.
Save zaneGittins/8bd21da866f7accf291329e7269b0009 to your computer and use it in GitHub Desktop.
# Check SMB Signing
function Get-SMBSigningStatus {
[CmdletBinding()]
$SMBSigning = (Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\LanManWorkstation\Parameters" -Name RequireSecuritySignature).RequireSecuritySignature
$Results = @()
if($SMBSigning -eq 1) {
return $true
} else {
return $false
}
}
# Check LLMNR
function Get-LLMNRStatus {
[CmdletBinding()]
$LLMNR = (Get-ItemProperty "HKLM:\Software\policies\Microsoft\Windows NT\DNSClient" -Name EnableMulticast).EnableMulticast
if($LLMNR -eq 0) {
return $true
} else {
return $false
}
}
# Check NetBios
function Get-NetBiosStatus {
[CmdletBinding()]
$NetBiosInterfaces = @()
$regkey = "HKLM:SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces"
Get-ChildItem $regkey |foreach { $NetBiosInterfaces += (Get-ItemProperty -Path "$regkey\$($_.pschildname)" -Name NetbiosOptions -Verbose)}
$AllDisabled = $true
foreach($Interface in $NetBiosInterfaces) {
if($Interface.NetbiosOptions -ne 2) {
$AllDisabled = $false
}
}
if($AllDisabled -eq $true) {
return $true
} else {
return $false
}
}
$SMBSigning = Get-SMBSigningStatus
$LLMNR = Get-LLMNRStatus
$NetBios = Get-NetBiosStatus
if($SMBSigning -eq $false) {
Write-Host "SMB Signing is disabled."
}
if($LLMNR -eq $false) {
Write-Host "LLMNR is enabled."
}
if($NetBios -eq $false) {
Write-Host "NetBios is enabled."
}
if($SMBSigning -eq $true -and $LLMNR -eq $true -and $NetBios -eq $true) {
Write-Host "Passed all security checks."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment