hl2guide

Download and Run Latest MS Safety Scanner - PowerShell

Feb 10th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Downloads and runs the latest MS Safety Scanner (64-bit only)
  2.  
  3. # Start edits
  4. # The full path for msert.exe
  5. $outputfile = 'D:\Portable Virus Scanners\msert.exe'
  6. # End edits
  7.  
  8. $url = 'https://go.microsoft.com/fwlink/?LinkId=212732'
  9. $start_time = Get-Date
  10. Write-Host 'Downloading MS Safety Scanner, please wait..' -ForegroundColor Cyan
  11. Invoke-WebRequest -Uri $url -OutFile $outputfile -UseDefaultCredentials
  12. Write-Output "Time taken to download MS Safety Scanner: $((Get-Date).Subtract($start_time).Seconds) second(s)"
  13.  
  14. # Run if it downloaded correctly
  15. if(Test-Path $outputfile)
  16. {
  17.     Start-Process $outputfile
  18. }
Add Comment
Please, Sign In to add comment