Before posting my thread I have checked this link
MTP driver update causes USB connected phone or portable device issue - Microsoft Support and done a few things. I saw that a Windows update(KB4016754) to remove WPD was installed on my pc on August 28, 2023.
I went to the next link
Redirecting and downloaded the windows troubleshooter and ran it, but it was not able to fix the issue.
I did the same after receiving your post but the Windows troubleshooter was able to solve the issue. Before troubleshooting I checked with
pnputil.exe -e and found that a Driver date and version : 02/22/2016 5.2.5326.4762 forgot the OEM#number(might be 29) is there in the system. After running the troubleshooter the driver was not there anymore. Tried connecting the phone again but received the same errors as posted in first mail. So, I went to check drivers with
pnputil.exe -e, again but this time I found that there is another
Driver date and version : 02/22/2016 5.2.5326.4762 but with OEM#10. Ran the troubleshooter again and it fixed the problem. But on checking with command prompt , the driver was still there. Tried deleting with
pnputil.exe -d oem##.inf but received this error
Deleting the driver package failed:One or more devices are presently installed using the specified inf.
I did not followed these steps from the link:
Method 1: Use a System Restore Point and
Method 2: Roll back the device driver and remove from system
Please note that I am using my phone without a SIM card, but I have wifi connection. If that is an issue,do mention.
Thanks