New
#1
Old devices and driver cleanup (one command)
Found this little gem of a command today. Wanted to share it with you. Nice to schedule this as a task running once a month?
Rundll32.exe c:\windows\system32\pnpclean.dll,RunDLL_PnpClean /DEVICES /DRIVERS /FILES [/MAXCLEAN]
For pnpclean output see c:\windows\inf\setupapi.dev.log
PNPCLEAN [/DEVICES] [/DRIVERS] [/FILES] [/MAXCLEAN] [/NOREMOVE] /? /help /h
/DEVICES Removes devices missing for the default time period
/DRIVERS Removes redundant drivers from the system
/FILES Removes files/directories that are no longer needed that are related to devices and drivers.
/MAXCLEAN Performs maximum cleanup
For /DEVICES this will set the time period to 0 so that every missing device will be processed for removal. (Note: Default missing device timeout period is 30 days!!!)
For /DRIVERS this will allow every driver that is not installed on some device to be processed for removal.
For /FILES this currently has no effect on what is removed.
/NOREMOVE Evaluate items only, do not remove
Did some testing and using it without /MAXCLEAN is probably best for using it in Task Scheduler once a month.
Cheers