Recovering OneDrive after ransomware
Did ransomware encrypt your OneDrive files? First clean your devices, then restore your files safely. Here is how to tackle it step by step.
Check which files are affected
Ransomware is malicious software that encrypts your files and demands a ransom to unlock them again. OneDrive syncs your files between your device and the cloud. As a result, the encrypted versions can also end up in your online storage and overwrite the healthy versions. The faster you react, the greater the chance that older, healthy versions are still available.
See which files have been encrypted or damaged by the ransomware. Also check whether any suspicious files have been added. Make a note of which files need to be restored.
- Do you recognise files that no longer open, have a strange extension or contain a ransom message?
- Take a photo or screenshot of the ransom message and keep it as evidence.
- Do not pay the ransom. There is no guarantee you will get your files back, and you would be funding the criminals.
- Do not open or change the affected files any further.
A common mistake is to first try opening the files once more or to click the message away. This can make the damage spread further. Don't feel ashamed: scammers are well prepared and anyone can fall for it.

You can find more information about ransomware at My files are being held hostage (ransomware).
First clean the connected devices
Check all devices connected to OneDrive for malware. Remove the ransomware before you continue with the recovery. This prevents OneDrive from being infected again.
If you restore your files while your computer is still infected, the ransomware can encrypt them again straight away.
1. Disconnect the affected device from the network: pull out the cable or switch off the wifi.
2. Disconnect external drives and USB sticks so that they are not encrypted too.
3. Think of all the devices connected to your OneDrive, such as a second computer, laptop or tablet.
4. Have an IT specialist or a reliable computer shop check and clean the devices.
5. From a safe device, change your passwords, especially those of your Microsoft account and e-mail, and switch on two-step verification.Do not ask for help from someone who phones or writes to you unprompted and poses as technical support. That is often a scam in itself.
Also read My computer or other device has been hacked and My account has been hacked.
Then restore OneDrive to a safe state
Use OneDrive's recovery options to put your files back. Choose a restore point from before the ransomware attack. Then check that the suspicious changes have disappeared.
What is possible depends on your account and your subscription. Also consult Microsoft's explanation via the link in the last step.
1. Sign in to OneDrive on the web via the official website, and not via a link from a message.
2. Look in the settings for the option to restore your OneDrive.
3. Choose a moment from before the problems began.
4. Review the list of changes and confirm the restore.
5. Is it just one or a few files? Then use the file's version history or the recycle bin.Menus can differ per version. Search the settings for 'restore' if you can't find the option straight away.
You can read more about the recovery options at Restore files with version history in OneDrive and Restore your OneDrive files after a ransomware attack.
Check that files open normally again
Open a few restored files to check that they work. See whether the content is complete and undamaged. Also check that no new suspicious changes appear.
- Test different types of files, such as a document, a photo and a spreadsheet.
- Watch out for new files with a strange name or extension.
- Check again after a few days that everything keeps working normally.
- Also keep important files on an external drive that you do not leave permanently connected. OneDrive is not a real back-up, because it also syncs damaged files.
Did you pay a ransom, share bank details or lose money? Then contact your bank straight away and read I am a victim of bank fraud. Also report it to the police via Police-on-web and keep your evidence. Did you first click on a suspicious link? Then read I clicked on a phishing link.