rj07thomas

CVE-2020-0601 check

Jan 15th, 2020
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. [string]$serverList
  2. [string]$serverNames
  3.  
  4. $serverList = Get-ADComputer -LDAPFilter "(&(ObjectCategory=Computer)(OperatingSystem=*10*))" -Property * #| Select-Object Name | Sort-Object Name
  5. #$serverNames = $serverList.Name
  6.  
  7. #$CVE20200601= Get-Hotfix | Where-Object {$_.HotfixID -like "KB4534306" -or $_.HotfixID -like "KB4534271" -or $_.HotfixID -like "KB4534276" -or $_.HotfixID -like "KB4534293" -or $_.HotfixID -like "KB4534273" -or $_.HotfixID -like "KB4528760"}
  8.  
  9. ForEach ($server in $serverList)
  10. {
  11. Write-Host ""
  12. $server.Name
  13. $server.OperatingSystem
  14. $isAlive = Test-Connection $server.Name -Count 4 -Quiet
  15. If($isAlive -eq $true)
  16. {
  17. [console]::ForegroundColor = "Green"
  18. Write-Host "PC is on"
  19. $CVE20200601= Get-Hotfix | Where-Object {$_.HotfixID -like "KB4534306" -or $_.HotfixID -like "KB4534271" -or $_.HotfixID -like "KB4534276" -or $_.HotfixID -like "KB4534293" -or $_.HotfixID -like "KB4534273" -or $_.HotfixID -like "KB4528760"}
  20. If($CVE20200601 -eq $true)
  21. {
  22. Write-Host "Hotfix installed"
  23. }
  24. Else
  25. {
  26. Write-Host "Hotfix not installed"
  27. }
  28. [console]::ForegroundColor = "White"
  29. }
  30. Else
  31. {
  32. [console]::ForegroundColor = "Red"
  33. Write-Host "PC is off"
  34. [console]::ForegroundColor = "White"
  35. }
  36. Write-Host ""
  37. }
  38.  
  39. Write-Host "Total number of Windows 10 PCs is" $serverList.Count
Advertisement
Add Comment
Please, Sign In to add comment