PowerShell: Test your antivirus with PowerShell

I have been doing a lot of work onboarding servers to Microsoft Defender recently, and I needed to test that it was running as expected in environment I only access to via PowerShell. There are of course lots of defender specific commands I used but this:

Invoke-WebRequest  "https://www.eicar.org/download/eicar_com-zip/?wpdmdl=8847&refresh=65d4b58cc7e0e1708438924" -OutFile c:\temp\test.zip

Will attempt to download a perfectly safe file that will flag up as a virus, and will work on all antivirus applications. Hopefully that is useful to someone.