Introduction to Printer Logon Scripts for Computers
What people want is a Windows logon script that will assign a printer to a computer - not a user. My advice is,
find another way! At least reconsider your strategy, redefine the problem and see how far you could get assigning a printer to all users or some other way.
O.K, you still want a script that will map a printer to a computer. Even though I
don't like the idea, I will give it my best shot, as ever I will tell you all that I know.
Let us begin with the computer start up sequence. The Windows operating boots up, a logon box appears and is waiting for a username and
password. Meanwhile, any computer logon scripts run, the operating system processes the computer section of the registry. So far so good. However, if you try and run a script that maps a
printer to all the users who logon, it just doesn't work. Even if you try assigning print permissions to the computer - no good. To my logic, this makes sense because otherwise, the operating
system could create a printer for a user, who had been absolutely denied print permission on this particular printer share.
By all means experiment, do tell me if I have missed a trick with a
StartUp computer script. However, do be careful, I once got carried away with the scripting, and put a pause statement in a computer script. Nasty. The machine just hung because no-one
could, 'press any key to continue'. Fortunately, I got out of the viscous loop thanks to Remote Desktop.
Four readers ride to my rescue
Remember that our goal is to assign a
network printer to a computer, no matter who logs on. The best part of this saga is the positive power of the internet. I have never met these four kind gentlemen, nevertheless they came to
my assistance.
Ben produced a
wonderful example of lateral thinking. He uses the little known loopback method available in Group Policies. What loopback does is turn the computer into a kiosk. No user settings are
applied, only computer setting - this just what we want.
In Group Policy navigate to: Administrative Templates\System\Group Policy and select: User Group Policy loopback processing mode, set
it to 'Merge'. Note navigate to the Group Policy folder, not the root of System.
Once Ben set the loopback processing, his printer scripts executed, even when he applied them to the computer
and not the user.
2) This deletes the networked printer from the machine being logged onto, and does so quietly. rundll32 printui.dll,PrintUIEntry /dn /q /n\\servename\printername
3) This Sets the default printer rundll32 printui.dll,PrintUIEntry /y /n\\servername\printername
Guy
Recommends: Permissions Analyzer - Free Active Directory Tool
I like the
Permissions Monitor because it enables me to see quickly WHO has permissions
to do WHAT. When you launch this tool it analyzes a users effective NTFS
permissions for a specific file or folder, takes into account network share
access, then displays the results in a nifty desktop dashboard!
Think of all the frustration that this free utility saves when you are
troubleshooting authorization problems for users access to a resource.
Adds a per-machine connection to the client machine. A per-machine connection is a printer configured to be
accessible by all users of the client machine. Normally, when a user adds a printer to a client machine, the printer is visible only to the account used by the person adding the printer. This command must
be run by a local admin of the client machine. The /ga switch is the key component which previous examples lacked.
Here is a little research that Guy undertook.
1) Check that RUNDLL32 PRINTUI.DLL,PrintUIEntry /? works on your machine, I mention this as it only seems to work on Windows 2003, XP and Windows 2003 machines.
2) Amongst the zillions of switches it seemed that the example: /in - add network printer connection, was the most promising, however I could not get it to work.
3) /y /n Worked to set the default printer. /y /n "Printer Name"
4) /ge /c \\machine also worked.
That was as far as I got, tantalizing and frustrating. And then Ian P. kindly sent in the fruits of his research
After some trial and error Ian came up with the following examples that worked
The
below adds the printer called PAN_FINANCE to the local PC. The PrintServer on the Domain is PNZ_PS rundll32 printui.dll,PrintUIEntry /in /n"\\print_servername\printername_on_server" eg rundll32
printui.dll,PrintUIEntry /in /n"\\PNZ_PS\PAN_FINANCE_HP4"
The below then sets that printer to be the default printer rundll32 printui.dll,PrintUIEntry /y /n"\\print_servername\printername_on_server"
eg rundll32 printui.dll,PrintUIEntry /y /n"\\PNZ_PS\PAN_FINANCE_HP4"
Here are Guy's original sources of information: Technet Q189105
Thus utility makes it easy to check the health of your router or
firewall. Check the real-time performance, and availability statistics, for any device
on your network.
Get started with an extensive collection of "out-of-the-box" monitors for
popular network devices.
Our mission is to create a script which will map a printer to a computer. Who ever logs on will find your choice of printer in their Printers and Faxes folder. At times this project seemed
like mission impossible but thanks to Ben, Pete and Randy, we got the job done.
The extra features you get in your eBook
include, more pages full of detailed examples. Also, ten 'how to...'
sections, with screen shots showing which menus to use. Go for Guy's
eBook - and get a printable version with copy enabled and no expiry date.
Windows Management Instrumentation (WMI) is one of the hidden
treasures of Microsoft operating systems.
Fortunately, Solarwinds
have created the
Free WMI Monitor so that you can actually see and understand these gems of
performance information. Take the guess work out of which
WMI counters to use for applications like Microsoft Active Directory,
SQL or Exchange Server.