Modern versions of Windows collect a huge amount of telemetry on you. But running older versions of Windows puts you at greater security risk, and running another OS may or may not always be feasible. So for those instances, it’s possible to use a hosts file to stop Windows from spying on you.
How to edit your Windows hosts file

Windows stores its hosts file in C:\Windows\System32\Drivers\Etc. This file is what your network stack uses to resolve domain names before reaching out to the nameservers. Or in less technical terms, the file lets you redirect Internet addresses to someplace other than their official address.
To edit the file, open an administrative command prompt by pressing your Windows key, typing cmd, and then selecting run as administrator from the options that appear to the right.
Then type the command notepad c:\windows\system32\drivers\etc\hosts and hit enter. Scroll to the end of the file. Paste the preformatted text (the text in monospace) from the section below into Notepad, then save the file and exit.
Contents of the Windows hosts file to stop spying
Here are the contents to paste into the file. Paste in the following 12 lines:
127.0.0.1 localhost ::1 localhost 127.0.0.1 data.microsoft.com 127.0.0.1 msftconnecttest.com 127.0.0.1 azureedge.net 127.0.0.1 activity.windows.com 127.0.0.1 bingapis.com 127.0.0.1 msedge.net 127.0.0.1 assets.msn.com 127.0.0.1 scorecardresearch.com 127.0.0.1 edge.microsoft.com 127.0.0.1 data.msn.com
Why Microsoft spies on you
Selling operating systems isn’t as profitable as it used to be. Theoretically, Microsoft can make more money collecting data on your behavior, profiling you, and then using that data to sell you stuff, or sell that profile to data brokers. Or, at the very least, it provides a constant revenue stream rather than just a $100 sale every three or four years.
The data companies infer from behavior isn’t perfect, but you can infer more from what news articles a person reads, what web sites they visit, and how they use their computer than we could in the old days, when all advertisers knew was what city you lived in and what magazines you subscribe to.
But if you don’t like the idea of being manipulated, this two-minute trick with the hosts file puts an end to Windows spying on you.

David Farquhar is a computer security professional, entrepreneur, and author. He has written professionally about computers since 1991, so he was writing about retro computers when they were still new. He has been working in IT professionally since 1994 and has specialized in vulnerability management since 2013. He holds Security+ and CISSP certifications. Today he blogs five times a week, mostly about retro computers and retro gaming covering the time period from 1975 to 2000.

… and if you have pesky teens that just WILL NOT keep off their devices then inserting
127.0.0.0 [name of site]
works a treat too. We had a few months without Youtube before secondary school exams last Summer. Burying this in the hosts file is beyond the reach of most IT aware teens, so far 🙂
Stockholders in Alphabet need not worry, Youtube was restored after the exams.