Try this on Windows 10:
Get-WindowsOptionalFeature -Online |
Select-Object FeatureName |
Select-String Internet-expl* |
If ($_ -match "FeatureName=(.+[^}])"){
Enable-WindowsOptionalFeature -FeatureName $matches[1] -Online
}
else{
Write-Host "Unable to find feature" -f Yellow
}
The code ASSUMES that there's either one matching feature, or no matching feature. The complete feature name on my machine is "internet-explorer-optional-amd64", so if you get multiple matches you can adjust the "Select-String" value accordingly to reduce the number of features to one.