-
×InformationNeed Windows 11 help?Check documents on compatibility, FAQs, upgrade information and available fixes.
Windows 11 Support Center. -
-
×InformationNeed Windows 11 help?Check documents on compatibility, FAQs, upgrade information and available fixes.
Windows 11 Support Center. -
- HP Community
- Printers
- Printer Setup, Software & Drivers
- Problem installing driver for Officejet 5740

Create an account on the HP Community to personalize your profile and ask a question
04-15-2020 10:57 AM
I had two laptops connected to my Officejet 5740 and one of them works well with the printer, it is a HP laptop running Windows 10. The other laptop is a Lenovo also running Windows 10. I purchased this Lenovo in November 2019 and installed the driver for the Officejet the day I brought it home and connected it wirelessly, and it worked well for 5 weeks. At some point Windows sent an automatic update to both laptops and the HP continues to work well with the printer as it did prior to the update. However, the Lenovo stopped being able to print to the 5740. I tried installing the printer again and the laptop finds the printer in the network, but it now says "The device was unable to be installed over the network." I tried reinstalling the driver but when I look in the Settings for Printer and Scanners for the 5740 it says Driver is unavailable. I tried to uninstall the driver but I get a message saying Call to Driver Uninstall returned error 5 for package.
So now I can't make any progress. Can anyone provide any assistance, please?
Oddly enough I also have a 4500 HP Envy printer and that one works well with both laptops. Thanks.
04-15-2020 11:39 AM - edited 05-14-2020 11:42 AM
Hi,
Please follow below steps to resolve such an error:
When you try installing or uninstalling the HP Basic Device Software for your printer, a form of the following error returns:
Note: if you have an HP Computer, follow the steps within the HP PC Solution section and do not follow any further steps within this section
- From the search bar type CMD, right-click on Command Prompt and select Run as Administrator.
- Copy the following command, then right-click the Command Prompt dialog and select Paste, then press Enter till any command completes
- processing:
takeown /f %windir%\System32\DriverStore\FileRepository /r /d y icacls "%windir%\System32\DriverStore\FileRepository" /grant %username%:(OI)(CI)F /T
Note: This provides your user full permissions to the File Repository system folder and deletes all HP's folders from within the system folder
for /d %G in ("%windir%\System32\DriverStore\FileRepository\hpwia*") do rd /s /q "%~G" takeown /f %windir%\System32\DriverStore\FileRepository /A /r /d y
Note: if you receive any Syntax error and your operating system language is in a different language than English, review the following Takeown command documentation from Microsoft for your language and modify the syntax accordingly. - From the Start menu click the Gear icon, select Apps and uninstall the HP Basic Device Software for your printer.
- Download and install the latest HP Basic Device Software for your printer as necessary:
https://support.hp.com/us-en/drivers/printers
HP PC Solution
- From the search bar type CMD, right-click on Command Prompt and select Run as Administrator.
- Copy the following command, then right-click the Command Prompt dialog and select Paste, then press Enter till any command completes processing:
takeown /f %windir%\System32\DriverStore\FileRepository /r /d y icacls "%windir%\System32\DriverStore\FileRepository" /grant %username%:(OI)(CI)F /T takeown /f %windir%\System32\DriverStore\FileRepository /A /r /d y
Note: This provides your user full permissions to the File Repository system folder
Note: if you receive any Syntax error and your operating system language is in a different language than English, review the following Takeown command documentation from Microsoft for your language and modify the syntax accordingly. - From the Start menu click the Gear icon, select Apps and uninstall the HP Basic Device Software for your printer and evaluate the error message, then close the Uninstall dialog.
Right-click the Start button and select Run, then paste the following path and press OK:
%windir%\System32\DriverStore\FileRepository
- Locate and delete only the HP Folder listed in the error message.
Example: following below error message, delete the hpwia_pw477dw.inf_amd64_efa093991b821954 folder as an example: - From the Start menu click the Gear icon, select Apps and uninstall the HP Basic Device Software for your printer.
- Download and install the latest HP Basic Device Software for your printer as necessary:
https://support.hp.com/us-en/drivers/printers
Click the Yes button to reply that the response was helpful or to say thanks.
If my post resolve your problem please mark it as an Accepted Solution 🙂
04-16-2020 08:32 AM
04-16-2020 11:10 AM
Did it provide any Access Denied error?
Generally, this indicates the active username you are logged in to.
Anyway, you may change the syntax to the following and check if that makes any difference:
icacls "%windir%\System32\DriverStore\FileRepository" /grant DESKTOP-4HHOL2T\Tracy B:(OI)(CI)F /T
Click the Yes button to reply that the response was helpful or to say thanks.
If my post resolve your problem please mark it as an Accepted Solution 🙂
04-16-2020 11:28 AM
Indeed, no quotes are required.
I did share the modified command after testing with my own PC first, with successful results for this exact syntax (where my own computer name and user name has been used of course)
Click the Yes button to reply that the response was helpful or to say thanks.
If my post resolve your problem please mark it as an Accepted Solution 🙂
04-16-2020 11:47 AM
Have you tried all 4 commands?
Assuming the previous test has failed, the ownership has been restored to the Administrators group, which makes sense to cause such an error:
takeown /f %windir%\System32\DriverStore\FileRepository /r /d y icacls "%windir%\System32\DriverStore\FileRepository" /grant DESKTOP-4HHOL2T\Tracy B:(OI)(CI)F /T
for /d %G in ("%windir%\System32\DriverStore\FileRepository\hp*") do rd /s /q "%~G" takeown /f %windir%\System32\DriverStore\FileRepository /A /r /d y
Please give it a try and let me know the results,
If that fails too, will appreciate a screenshot of the screen, be sure to include the results after the first takeown command and the second icalcs command, so it may be more clear visually.
You may share it via a private message to avoid posting any personal information by any chance.
Shlomi
Click the Yes button to reply that the response was helpful or to say thanks.
If my post resolve your problem please mark it as an Accepted Solution 🙂