Hello,
Sometimes, corruption in system components can cause this error. You can try cleaning up the system components and specifying an alternate Windows image repair source.
To do this, open the Group Policy Editor by running gpedit.msc
Navigate to the following settings:
Computer Configuration > Administrative Templates > System
Look for the setting named Specify settings for optional component installation and component repair.
Enable it and specify an alternate source (you can use the original Windows installation media).
After making these changes, retry installing IIS.
Hope this helps.
Best Regards,
Hania Lian
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.