Network Printer Management from Command Prompt

0
(0)

rundll32 printui.dll,PrintUIEntry

printui.dll is an library for automated printer configuration tasks with features used by the printer configuration dialog boxes. These features can also be called from a script or command-line batch file, or run interactively through the command prompt.

printui.dll runs with rundll32.exe to provide tools for demanding tasks, add printers, manage, delete, and add network printer connection.

Open printer server properties

Open properties of printer server

Connect to the network printer:

rundll32.exe printui.dll,PrintUIEntry /in /n \\server\LaserJet

The LaserJet network printer which is shared on the SERVER, is installed on the client computer and connected to the server.

Setup printer using driver INF-file:

rundll32 printui.dll,PrintUIEntry /if /b "AddressLabel" /f C:\Driver\Zebra\ZBRN\ZBRN.inf /r "10.10.10.89" /m "ZDesigner GK420t" /Z

/if Installs printer using the specified INF-file
/b Basic printer name AddressLabel
/f Path to the printer driver INF-file
/r Portname or IP address
/m Model name of the printer driver from the INF-file
/Z Share this printer, use only with option “/if”

Delete local printer driver:

rundll32 printui.dll,PrintUIEntry /dd /m "LaserJet" /q

/dd Deletes the local printer driver
/m Model name of the printer driver
/q Do not display possible error messages

Delete network printer connection:

rundll32 printui.dll,PrintUIEntry /dn /n "LaserJet" /q

/dn Deletes the network printer connection.
/n The name of the printer.

  Help on printui.dll is get with the following command in the command prompt.

rundll32 printui.dll,PrintUIEntry /?

Batch example:

Example add network printer connection use from Loginscript.

@echo off
@REM Batch Network printer connection
if /i %computername:~0,2%==BE goto Bern 
if /i %computername:~0,2%==BS goto Basel
if /i %computername:~0,7%==SPECTRE goto LAPTOP
goto END
:Bern
@REM Network printer connection Bern
rundll32 printui.dll,PrintUIEntry /in /n \\SERVER\LaserJet_BE
goto END
:Basel
@REM Network printer connection Basel
rundll32 printui.dll,PrintUIEntry /in /n \\SERVER\LaserJet_BS
goto END
:LAPTOP
@REM Network printer connection SPECTRE
rundll32 printui.dll,PrintUIEntry /in /n \\SERVER\OfficeJet_HO
goto END
:END

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave a Reply

Your email address will not be published. Required fields are marked *