Network Printer Removal - GPO Configured



  • Network Printer Removal that were configured via GPO

    I wrote this script some time ago because we were replacing our printers, that were all configured via GPO. Removing the printers would've been a pain in the rear otherwise. This script will simply delete the GPO that created the connections and allow you to follow up with a GPO update to pull in any new printers.

    	@ECHO off
    	title Printer System Cleanup
    
    	::Stopping the Print Spooler
    		net stop spooler
    		ECHO.
    		ECHO Cleaning up the registry a bit, Please Wait ...
    		ECHO.
    
    	::Removing Network Printer Registry Keys
    		ECHO Y | reg delete HKEY_CURRENT_USER\Printers\Connections\
    		ECHO.
    		ECHO Registry cleanup completed, starting print spooler.
    		ECHO.
    
    	::Starting the Print Spooler
    		net start spooler
    		ECHO.
    		ECHO Printers are on their way, this'll take a minute or two.
    		ECHO.
    
    	::Forcing a GPUPDATE
    		ECHO N | gpupdate /force
    		ECHO.
    
    	::Opening up the devices and printers window, and loading the printers to confirm for the end user. 
    
    		ECHO Printers are now added, please confirm by checking the recently opened window.
    		control /name Microsoft.DevicesAndPrinters  
    		ECHO.
    		ECHO.
    		ECHO.
    		ECHO Make sure to set your DEFAULT printer!!
    		ECHO.
    		ECHO Done!
    		ECHO.