Can I extract the Stock HTC firmware (Sense) from an M8 and flash it in another rooted M8? I rooted my friend's HTC M8 upon his request and also put TWRP in it. He tried many ROMs, including AOSP, but couldn't live with the bugs. So, he asked me to revert his phone back to stock with Sense on it and the ability to install OTA updates (basically unroot the phone).

I searched a lot over the Internet on how to unroot an HTC M8 but nothing worked. So, I flashed SkyDragon ROM hoping it would be the closest to stock HTC, but it has its own bugs.

My sister also has an HTC M8, which has never been tampered with (no root) and currently runs Android 6.0.1. I've been thinking for some time if I could somehow extract the Stock HTC firmware from my sister's unrooted M8 and put it in my friend's rooted M8. If I could get this latest version of HTC firmware in my friend's phone (even as a flashable ROM), I don't need to worry about future OTA updates, since this is proably the last update for M8. I understand that first I would probably have to root my sister's phone for that, but that's okay if I can just make sure that she stays on pure HTC stock afterward (I would probably need help for this too).

Is there any way to do this? Or it would also be great if someone could post a working method to unroot the M8 and install OTA updates. That way would be much simpler.

I live in India and both the M8s are the international version.
Hey I had the same problem I tried everything. Then I did this - I downloaded ruu file for my m8 and it works like a charm now . You just have to run the ruu file on windows while your phone is connected. Beware finding the right ruu files takes time. And also it requires you to be on the correct mid and Cid that came with your phone (or the developer Cid number 11111111)