How to fix Vista driver cache
I've installed Vista on 3 machines now, and on all 3 something I've done has caused the Vista driver cache to become corrupt. So, when plugging in a USB device which it should recognize automatically, it instead says "Driver not found" and gives me options to repair it. While you can tell it to browse for a location manually, and choose c:\windows to get around this, I have created a batch file which will allow you to force Vista to rebuild the driver cache. You have to be an administrator on your system to use it, and it works with UAC enabled.
Create a batch file with the following content and execute it as an administrator (Right click it, choose Run as Administrator). It will create a directory labeled \windows\inf\infbk-XXXX (where the XXXX is replaced with a random number), set the relevant files to be owned by "Administrators", give "Administrators" full control over the files, and move them to the backup folder. After running this you should be able to just plug in a new device, although you might want to reboot first.
Here is the content of the batch file:
@echo off
TITLE Repairing Inf Cache
rem change to drive where windows runs
%SystemDrive%
rem change to the \windows\inf folder
cd %SystemRoot%\inf
rem create random directory for backup
set FOLDERNAME=infbk-%RANDOM%
mkdir %FOLDERNAME%
rem list of files which need to be removed
set FILE1=INFPUB.DAT
set FILE2=INFSTOR.DAT
set FILE3=INFSTRNG.DAT
set FILE4=INFCACHE.*
set FILE5=SETUPAPI.*
rem take ownership of the first file
takeown /f %FILE1%
rem grant full control to 'administrators'
icacls %FILE1% /grant administrators:F /t
rem move it to the backup folder
move %FILE1% %FOLDERNAME%
rem same for the other files
takeown /f %FILE2%
icacls %FILE2% /grant administrators:F /t
move %FILE2% %FOLDERNAME%
takeown /f %FILE3%
icacls %FILE3% /grant administrators:F /t
move %FILE3% %FOLDERNAME%
takeown /f %FILE4%
icacls %FILE4% /grant administrators:F /t
move %FILE4% %FOLDERNAME%
takeown /f %FILE5%
icacls %FILE5% /grant administrators:F /t
move %FILE5% %FOLDERNAME%
echo Successfully moved all infcache related files to %FOLDERNAME%
pause

34 Comments:
*finally* a solution to this problem that "just works". No turning off UNC, no trying to follow instructions that someone said 'worked for him', but a simple, quick answer that finally did the trick for me.
Thanks!
Thank You Very Much!!! I've been struggling with my USB mouse for days now. And thanks to you HowTo, I got it up and running. Thanks again.
omg it worked, it worked... Ohhh my gawd it worked! For weeks I've been struggling with this and now my problem has been fixed.
Thanks, thank you so much!!
Which are the relevant files ?
Thank you for your help
What do you mean, "move them to the backup folder"?
Didn't work for me. Maybe because I didn't move the file to the 'backup folder' (wherever that is) HEEEEELP!
please give more detailed instructions ! thank you
This fix worked fantastically. How did you find out to do this?
Could you please explain what folder you're referring to when you're talking about "the backup folder"? More detailed information would be appreciated, thanks!
Anonymous, the backup folder referred to in his post is created by the batch file itself. You do not have to do anything but create the .bat file and run it for the process to work its "magic".
I found that after I ran the batch file, I had to reboot and manually search for drivers again, but this time the OS picked them up and installed successfully.
Many thanks for this incredibly useful nugget of info, i've passed on the link so hopefully more peeps can make use of it. Thanks agains
BIGG thanks, you saved me alot of work.
Thanks!!
Guys how do you give "Administrators" full control over the files? and the other bit about administrators?
Cheers
Thanks so much for this. You have just saved me a lot of time. If only Google had have found you quicker! Works perfectly. I don't need to wipe my machine now.
i know this is quite a bit later, but i used this a couple months ago and it worked, but just recently a vista update (either (KB938371)or (KB890830)) and this causes my computer to turn of fine,and i can still access its files through my network, but as soon as the update came i could not use any usb devices at all anywhere, so i had to restore with a recovery, the only culprate i can think of was this mod, as ive done no other changes to my os, i was just wondering if this has happend to you or anyone else that has used this,
rob, rechik97@hotmail.com
THANKS so much! like allen i've been struggling to solve my vista-mouse problem for days. Your solution is so easy. What i did:
1. create the batch file, just name it anything with .bat and i saved it on my desktop.
2. right click and run it as administrator
3. reboot
4. with PS/2 mouse, it will immediately work. for USB might need to manualy search for drivers again.
Woohoo, finally this works. Thank you so fucking much =).
I love ya!
Thanks so much i had the same problem when trying to plug in any device i had, but now it all works. THANKS SOO MUCH
Finally Someone with a little Brains!! Thanks for the fix!!
What about fixing the same issue in XP?
simply genius
Awesome! Thanks!
I tried this script on Vista SP1 and it really screwed up my computer. Now no drivers will load. It says "Windows found driver software for your device but encountered an error while attempting to install it". "The system cannot find the file specified". Now none of the built-in Windows drivers can install. Restoring the backups doesn't work either, and SFC /scannow can't fix it. Unfortunately, I changed hard drivers recently and didn't realize my System Restore isn't working, so now my PC is royally screwed.
This helped me a lot too! Although I had to do one more step,
Point the Update Driver wizard to:
c:\Windows\System32\DriverStore\FileRepository\
Thank you very much! been having this problem a long time now... it´s the first time i can transfer more than 3 albuns to my jump drive...
Nothing has worked for me so far...
Anyone has another solution?
OMG--you just ended a 48 hour nightmare! My problem was much deeper--I couldn't boot into my other operating system because the driver cache entry for "generic volume" became corrupt, and Vista wouldn't allow me to mount and fix that drive...and it wouldn't even let me manually point it to the inf. I was about to delete the other partition and start from scratch...BUT NO LONGER! THANK YOU!
Thanks!
have a PC running Vista with SP1 which had problems with a Netgear WG111T USB WiFi adaptor, the Netgear utility wouldn't run and there were occasional blue screens, typically when trying to hibernate the system, reporting an error in WG11TND5.SYS. Attempts to re-install the driver gave an error along the lines of "name is already in use as either a service name or a service display name".
Booting in safe mode, deleting all "netgear" and WG11* references and folders on the system didn't help.
Running the batch file did ... as I was then able to re-install the software and the driver, it is now working perfectly (including hibernate) - so a big pat on the back - and it works fine on Vista SP1 for me!!! :-)
Dan SJK
Thank you very much Peter, you saved my life.
After rebooting my laptop due to the unresponsiveness of Vista, I lost the connection to wireless keyboard and mouse. I spend a day to look for a solution from Microsoft support site and numerous technical pages without any success. Your batch file and a reboot fixed it for me.
I cannot believe that something discovered in 2007 is still causing trouble and there is no solution from Microsoft.
Damn you Microsoft, Damn you Vista.
Cheers,
Tevfik
Sorry, how do you do the following action (the one Henson mentioned):
Point the Update Driver wizard to:
c:\Windows\System32\DriverStore\FileRepository\
thanks,
Jaime
Oh my goodness, that's amazing.
THANK YOU!!
i saxed this bat file for future. but i accidenlty ran it. Now NONE of my usb drivers are uptodate and i cannot find updates for them. YES i tried manually to update no use and i tried to find online no use so far. Perhaps you could firect us as to where the backup file is. My sys back up was on a HDD but of course NONE of the usb devices work. And i recommended this to many friends in a forum. THANK GOD i listed your site so you could get the credit. Unfortunately the restoe point i could have used was auto deleted by vista i understand this is an old blog and useful for many so it prolly works well but i had a glitch and do not know fow to fix unless i do a total recovery, Please advise
I was minutes away from re-installing Vista from scratch....thanks so much for this, worked like a charm...
I haven't been able to use a flash drive for months and it has been such a pain! thanks!
Post a Comment
<< Home