Funny thing, on each and every antivirus forum we ask this question the answer is the same "Yeas, our antivirus will protect you against Wannacry", yet 100000 pc were infected...
John,
Your question is based on an assumption that the PC's were infected inspite of having AV software installed & also that without having seen the 'attack vector' before that AV software could catch it.
All AV software works on the basis of 'Known Attack vectors' which can be coded for or known methods that can be caught via any Heuristic based methods.
All the AV vendors will by now be able to detect and catch 'Wannacry' because samples have been caught and examined.
NO AV software will protect you 100% from all possible attacks.
The point of using AV & Anti-malware is to cover as many as you can (get as close to 100% as you can) but you still need to use common sense (that is not so common !!!).
This means you ensure you have
good backups of your data that you
verify work on a regular basis. (This is the final fallback if your AV & Anti-malware should fail.)
You do not open e-mails or documents or run software from sources that you cannot have confidence in.
If you know that you are going to open/run unknown docs/software, you do it on a machine that is isolated from the network/internet, so that it cannot 'run amok' via your network connection.
Ideally, if you are knowingly running suspect software or accessing suspect files you would do this in a VM (Virtual machine) that is isolated from everything and running on a controlled 'virtual / internal' network that is NOT connected to anything you cannot 'wipe and rebuild' if need be. [remember that VM's are not 100% safe as there are exploits that can 'break out' of VM's.]
Everyone should learn from the 'Wannacry' events that regular backups and regular testing of those backups is essential.
Do not assume that your backups are working ....... check the backups that you create, are accessible, complete and you can get ALL your files back when you try to restore.
Follow a proper backup schedule with multiple copies of your backups kept and make sure that they are kept in multiple safe locations.
(Remember that Viruses etc are not the only risk, if there is a fire or flood would you lose your backups as well. !!!)