Well, Skynet was given a complete control to do just that, get rid world of viruses. But jokes aside, a supercomputer with AI involved could really do that, but unfortunately even more given autonomy, which is required in order to do its job effectively. Like it could put a backdoor into every computer in order to track it to prevent it from being infected or even seize control of some computers to protect more important computers, etc.