Do you have your Windows 7 machine updated and set to update with the latest patches? WannaCry virus uses ETERNALBLUE exploit, which is has been patched by Microsoft security update MS17-010 released in March 2017. You should check to see if the updates in this article have been applied.
For older systems (Windows XP, Windows Server 2003 R2), Microsoft released special patches.
Below is a screen shot of the January 2017 security rollup that fixed this vulnerability on Windows 7. Check to see if it is installed on your Windows 7 computer – if not turn on Windows Update and make sure it does get installed.
Here’s a great way to have Windows regularly check and apply critical updates. Let it run in the background and never have Windows Update disturb or notify you, so it can do its job silently and reliably. Critical updates happen every few weeks and definitely every month as a “Security Monthly Quality Rollup.”