Windows 7 Remove HP Universal Print Driver
Jump to navigation
Jump to search
Remove the HP Universal Print Driver without (hopefully) breaking other printers on the machine.
In this example the print server will re-push the drivers out when the spooler restarts. (hence rem'd out driver install at the end)
@echo off
net stop spooler
taskkill /f /fi "modules eq UNIDRVUI.DLL" 2>nul
echo Reset permissions on spool drivers
icacls "C:\Windows\System32\spool\drivers\x64\3" /T /Q /RESET
echo Clearing spool
attrib /s /d -R -H -S "\\.\%windir%\system32\spool\Printers\*" 2>nul
del /f /q /s "\\.\%windir%\system32\spool\Printers\*" 2>nul
for /f "delims=" %%i in ('reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Drivers\Version-3" /k /f "HP Universal Printing" ^| find "HP Universal Printing"') do (
for /f "tokens=4" %%j in ('reg query "%%i" /v "Print Processor" ^| find "Processor"') do (
echo Deleting Print Processor "%%j"
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\%%j" /f
)
for /f "tokens=3" %%j in ('reg query "%%i" /v "Monitor" ^| find "Monitor"') do (
echo Deleting Print Monitor "%%j"
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\%%j" /f
)
for /f "tokens=4* delims= " %%j in ('reg query "%%i" /f "File" /se " " ^| find "File"') do (
for /d %%x in (%%j %%k) do (
if exist "%windir%\system32\spool\drivers\x64\3\%%x" (
taskkill /f /fi "modules eq %%x" 2>nul
del /f /q /s "\\.\%windir%\system32\spool\drivers\x64\3\%%x"
)
)
)
echo Deleting Driver reg %%i
reg delete "%%i" /f
)
echo Deleting Monitors reg
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\HP Universal Print Monitor" /f
for /f "tokens=4 delims=\" %%i in ('findstr /M /I /C:"HP Universal Printing" c:\windows\inf\oem*.inf') do (
echo Deleting oem inf "%%i"
pnputil -f -d "%%i"
)
rem echo Installing Drivers
rem pnputil -a c:\temp\pcl6-x64-5.5.0.12834\*.inf
net start spooler
Comments
blog comments powered by Disqus