I recently came home to find my computer displaying a full-screen message claiming I had a Trojan virus. It even had an AI voice talking to me, and I couldn't close it using Alt + F4 or by opening the task manager, so I had to use a hard reset. I realize this was a scam, but I'm curious about why these things happen and what steps I can take to avoid them in the future.
2 Answers
One of the best ways to avoid these scams is to use an ad-blocker. Many of these scams are spread through malicious ads on seemingly innocent websites. An ad-blocker can help prevent those ads from ever showing up in the first place.
You might want to share more details about what you've been doing on your computer lately. Knowing your browsing habits can help figure out how you encountered this malware.

I had Edge open, and suddenly it launched a different application that looked like Windows Defender. It seemed pretty convincing at the time.