Advertisement
FatalBulletHit

https://youtu.be/6ZGqKUQkWA4 You might want to turn off real time protection - PowerShell

May 23rd, 2022
765
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $GetDuplicates = {
  2. $HashList = New-Object System.Collections.ArrayList
  3. $Duplicates = New-Object System.Collections.ArrayList
  4. (Measure-Command {
  5.     foreach ($item in (Get-ChildItem -File)) {
  6.         if (!$HashList.Contains( ($Hash = (Get-FileHash $item.FullName -Algorithm MD5).Hash) )) {
  7.             $HashList.Add($Hash) >$null
  8.         } else {
  9.             $Duplicates.Add($_.FullName) >$null
  10.         }
  11.     }
  12. }).ToString('m\:ss\.fff')
  13. }
  14.  
  15. for ($i = 1; $i -lt 3; $i++) {
  16.     "`n Iteration $i"
  17.     Set-MpPreference -DisableRealtimeMonitoring $false
  18.     Write-Host '   Real-time protection enabled :' -NoNewline
  19.     & $GetDuplicates
  20.     Set-MpPreference -DisableRealtimeMonitoring $true
  21.     Write-Host '   Real-time protection disabled:' -NoNewline
  22.     & $GetDuplicates
  23. }
Advertisement
RAW Paste Data Copied
Advertisement