Contents of Guy's Scripting Ezine No 16a: RUNDLL32 PRINTUI.DLL,PrintUIEntry - Printer Scripts
I love co-operation. This section illustrates the mutual help capability of the internet.
The initial challenge was to find a method of assigning a printer to a computer rather than a user. What we wanted was a logon script that would create a printer no matter who logged on.
The basic command is: RUNDLL32 PRINTUI.DLL,PrintUIEntry
Here are three useful commands kindly sent in by Pete Roper.
1) This installs printer quietly rundll32
printui.dll,PrintUIEntry /in /q /n\\servername\printername
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: A Free Trial of the Orion Network Configuration Monitor
(NCM) v6
Config management of routers, switches and firewalls is fun with
NCM (Network Configuration Manager.
Furthermore, it can help to
achieve your compliance policy, for example, pinpoint devices not backed
up and discover access infringements or even weak passwords. This Solarwinds NCM suite can not only detect violations, but also upload
scripts to correct the problem.
Most computer problems arise from configuration changes. Thus it makes
sense to get a proper monitoring system so that you can double-check that that
all the settings confirm to your security policy.
Download your free trial of Orion's Network Configuration Monitor.
Warning this script will need adjustment for your environment. For example edit the set pserver = CLTLBXPRN
Warning this script is viscous and will delete all your mapped printers.
@echo off path=c:\util;%path% set pserver=CLTLBXPRN echo Remove All Network Printers....... con2prt /f echo Show All Available Printers From %pserver%....... net view %pserver%
set /p pname= Enter Printer Name: rundll32 printui.dll,PrintUIEntry /in /n\\%pserver%\%pname% /q set pserver= set pname= exit
Here is a little research that I 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 2000 machines.
2) Amongst the zillions of switches it seemed that: /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 is as far as I got, tantalizing and frustrating.
Here are my original sources of information:
Their topics and material are ideal for getting you started with VBScript. The
videos are easy to follow and you can control the pace. Try their free demo material and then see if you want to buy the full package.
See more about VB Script Training CD.
|