Recently there was a case where a Windows Server 2016 print server was set up, and very odd things happened vis a vis one particular large MFP: When any non-admin user changed printer settings on her/his PC only, those settings were replicated to all users on all PCs who had that printer. Microsoft printer deployment was doing it somehow; testing was done both using Print Management and the other GPO print setup method, same result. When manual mappings were used to replace the deployments via Windows Explorer, the symptom went away.
Thus the CMD script below. It can be run as administrator from a PC or remotely via psexec, or a variety of other ways. It installs the driver into the PC, and via scheduled task, any new user that logs into the PC, will have his/her own new mapping to the printer.
ECHO This script will (a) install the driver for a server-shared
ECHO printer into a PC by UNC, and (b) set up a Scheduled Task
ECHO to map that printer to any user at logon if they have
ECHO permissions for that printer.
ECHO It has to be run as administrator, and it requires
ECHO two command line arguments:
ECHO first, a unique, optionally quoted, short name for the printer,
ECHO used in the task name only;
ECHO and second, the quoted UNC path of the printer.
ECHO If the unique name already exists in the system,
ECHO it will be overwritten. The short name can have no slashes.
:: 1. Get printer printer UNC path via command line.
:: 2. Install printer driver into PC. This is done by a RUNDLL install of the printer to the administrator user,
:: and is one of two reasons this script has to be run as administrator.
:: Example: rundll32 printui.dll,PrintUIEntry /q /in /n "\\machine\printer"
:: 3. Set up scheduled task, to be run at user logon and using user creds, to install the printer to the user profile.
:: First we do have to dequote the variables.
:: Step 1.
ECHO Printer to be set up: %UNCpath%
ECHO Using short name: %UniqueName%
:: Step 2.
:: Install the printer into PC as administrator.
ECHO Installing printer as administrator, to get driver in...
rundll32 printui.dll,PrintUIEntry /q /in /n "%UNCpath%"
:: Step 3.
:: Set up the at-login scheduled task...
ECHO Set up the at-login scheduled task...
Set RunString=%windir%\System32\rundll32.exe printui.dll,PrintUIEntry /q /in /n
echo Task will run: %RunString% %UNCpath%
schtasks /Create /F /SC ONLOGON /TN "%1" /TR "%RunString% \"%UNCpath%\""
ECHO Script completed.
Quietly install a network printer – per user
rundll32 printui.dll,PrintUIEntry /q /in /n "\\machine\printer"
Quietly delete a named network printer – per user
rundll32 printui.dll,PrintUIEntry /q /dn /n "\\machine\printer"
Set default printer
rundll32 printui.dll,PrintUIEntry /y /n "\\machine\printer"
Quietly install a network printer – per machine
rundll32 printui.dll,PrintUIEntry /q /ga /n "\\machine\printer"
Quietly delete a network printer – per machine
rundll32 printui.dll,PrintUIEntry /q /gd /n "\\machine\printer"
Quietly delete a specific printer driver
rundll32 printui.dll,PrintUIEntry /q /dd /m "PrinterDriver"
Windows 10 has some sort of automatic thing built in which is pretended to read our minds and decide for us which of our printers should be the default at any time. Needless to say this makes no sense at all, and causes lots of user frustration. To turn this off with Group Policy, browse to:
User Configuration -> Administrative Templates -> Control Panel -> Printers
and set “Turn off Windows default printer management” to Enabled.
From Windows 7 on, Microsoft has thoughtfully provided us with VBS scripts for command-line printer management, here:
In this dot on the globe, we go to the following system folder to see them all, there are several:
To delete printer named ASDF:
cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -d -p "ASDF"
There are multiple ways to set printers up by group policy in Windows. There is a printer administration role which can make things easier or harder, depending on how well everything is working. The simplest way, is to open the Group Policy Management Console from a domain controller, open up an appropriate policy, and open it to here:
then right-click in the white box, you’ll get a menu, choose “New”, choose “Shared Printer”, Action should be “Update” or “Replace” if “Update” doesn’t work, and you’ll choose the printer by “Share Path”. You can leave everything else alone unless you need something special. Sometimes it works better to do a Delete and then Create for each printer. The vagueness here is due to unknown but widely experienced vagaries in behavior of Group Policy which are addressed in no known documentation.
Please do note that we set these up under “User Configuration” not “Computer Configuration”. It is possible to do it under Computer, but removals can be far more difficult if we do, there have been messes seen.
If there is a Canon MFP, and the desire is to implement user codes, you need more than just a driver. You need the current UFR II sort of driver, and very significantly, you need something called the “Canon Driver Information Assist Service”. This is in the “misc” folder in the driver package, it’s called DIAS for short. This is a service which makes network user codes flow from desktop to server to MFP. Without it, you will get errors as user code lookup attempts fail.
If you get “permission denied” trying to delete printers, delete everything relevant in all of these places (leaving the folders of course):
restart the spooler, refresh the Devices and Printers window, and you may be done, the involved printers will probably vanish. If they don’t they will be deletable at this point. If there are multiple user profiles on the PC, you will have to delete them in the other profiles. On some machines, some of the folders won’t exist, and this is perfectly fine.
In Server 2008 R2:
- Click Start, Administrative Tools, Print Management.
- Open up Print Servers.
- Right-click on the server whose print server spool you wish to change.
- Click Advanced.
- Set your new folder.
- Open the Control Panel.
- In ‘Hardware and Sound’, select ‘Printer’.
- On the left-hand tree menu, right click on ‘Printers’, and select ‘Server Properties’.
- In the ‘Print Server Properties’ window, select the ‘Advanced’ tab.
- Set a new path for the spool folder.
- Change the Port, to “FILE:”, and then try to delete it again. If that doesn’t work:
- Go to this registry location:
and delete the ones that you want gone. Then restart the Windows service named ‘spooler’.