Скрипт PowerShell, проверяющий хосты локальной сети на наличие установленных патчей уязвимости протокола SMBv1
# -- function Find-CryHotFixes { param([string]$ComputerName) # List of all HotFixes containing the patch $hotfixes = @( "KB4012598", "KB4012212", "KB4012215", "KB4015549", "KB4019264", "KB4012213", "KB4012216", "KB4015550", "KB4019215", "KB4012214", "KB4012217", "KB4015551", "KB4019216", "KB4012606", "KB4015221", "KB4016637", "KB4019474", "KB4013198", "KB4015219", "KB4016636", "KB4019473", "KB4013429", "KB4015217", "KB4015438", "KB4016635", "KB4019472", "KB4018466") # Search for the HotFixes $HotfixIDs = Get-HotFix -ComputerName $ComputerName | Where-Object {$hotfixes -contains $_.HotfixID} | Select-Object -ExpandProperty "HotFixID" $obj = New-Object -TypeName PSCustomObject -Property @{ ComputerName = $ComputerName; CryHotFixes = [string]$HotfixIDs } $obj | Write-Output } # -- Clear-Host $FoundFixes = @() Get-ADComputer -Filter { Enabled -eq $true } ` -Properties IPv4Address -SearchBase "OU=Computers,DC=office,DC=domain,DC=com" | Where-Object { Test-Connection -ComputerName $_ -Quiet } | ForEach-Object { $pc = $_ $FoundFixes += ( Find-CryHotFixes -ComputerName $pc ) } $FoundFixes | ft -au