• ×
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
  • ×
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
Guidelines
We have new content about printers, Click here to check it out!
Check some of the most frequent questions about Instant Ink: HP INSTANT INK, HP+ PLANS: INK AND TONER.


Check out our WINDOWS 11 Support Center info about: OPTIMIZATION, KNOWN ISSUES, FAQs AND MORE.
HP Recommended
Officejet 5740 All-in-one
Microsoft Windows 10 (64-bit)

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.

brbonetti_0-1586969648770.png

 

12 REPLIES 12
HP Recommended

Hi,

Please follow below steps to resolve such an error:

 

Symptoms

When you try installing or uninstalling the HP Basic Device Software for your printer, a form of the following error returns:

DriverPackageUninstallError5.png

Solution

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
    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: This provides your user full permissions to the File Repository system folder and deletes all HP's folders from within the 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.
  • 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:
    DriverPackageUninstallError5HP.png
  • 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 🙂
HP Recommended
Thanks Shomil, but it didn't quite work. The command "icacls "%windir%\System32\DriverStore\FileRepository" /grant %username%:(OI)(CI)F /T" seems to use the wrong user name, because it used "Tracy" instead of the full name "DESKTOP-4HHOL2T\Tracy B". Is there a way to use that name instead of the variable "%username%"? When I try to delete the file in the error message it says "You require permission from D.ESKTOP-4HHOL2T\Tracy B to make changes to this folder" I think we are almost there. Thanks for your help.
HP Recommended

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:

Spoiler
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 🙂
HP Recommended
No quotes required since there is a space between Tracy and B?
HP Recommended

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 🙂
HP Recommended
Slightly different error message, now it just says You need permission to perform this action You require permission from Administrator to make changes to this folder
HP Recommended

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:

Spoiler
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 🙂
HP Recommended
Should I execute each command line individually? It almost seems like it gave authority to DESKTOP....Tracy B and then removed the authority. All three commands ran sequentially.
HP Recommended
How do I share it via private message?
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the <a href="https://www8.hp.com/us/en/terms-of-use.html" class="udrlinesmall">Terms of Use</a> and <a href="/t5/custom/page/page-id/hp.rulespage" class="udrlinesmall"> Rules of Participation</a>.