tech.gate.io blog
Background:
The service contract of my old Xerox Workcenter (XM55) ran out(and I'm glad about it)!
A few weeks ago I ordered a new printer DC2250 from “Triumph Adler†aka. Kyocrea KM5050.
So all my users need to get it as the standard printer, but I'm damn lazy so the job have to be done remote.
Lately we got a second printer server, so some of the user use the printer from \\printerserver1 and a few from \\printerserver2. The \\printerserver1 crashes from time to time so I just want to add the new printer on the new printer server and delete the old machine.
Solution:
Servers I use:
\\printerserver1 #Old printer server which crash from time to time
\\printerserver2 # New stable printer server
\\dc #Have a guess, yes this is a MS Domain controller, where the AD is hosted
\\fileserver #network share for the users
old printer is Called Xerox full path \\printerserverX\Xerox
new printer is called Dc2250 full path \\printerserver2\DC2250
As I use the MS Active Directory I can use the Logonscript to get this job done.
If you ain't have a logonscript for your employees now, we will create one. My Test user is called John Dow.
I want to mount the network share, add a printer and set it to the standard printer, and delete the old printer. As you can imaging rename or deleting a printer on the server , while users got it mounted will lead you into trouble, so please don't try it.
Okay let start:
Create a new file called jdow.bat
Now open it in your favorite text editor and copy this:
net use * /del /yes rem delete all file shares net use h: \\fileserver\%USERNAME%$ /persistent:yes rem mount the network share of the user persistent net use * \\fileserver\public\sales /persistent:yes rem file share e.g. sales dependss on your filestructur rem now the printers rundll32 printui.dll,PrintUIEntry /q /dn /n\\printerserver1\Xerox rem Printer Xerox at printerserver1 will be deleted rundll32 printui.dll,PrintUIEntry /q /dn /n\\printerserver2\Xerox rem Printer Xerox at printerserver2 will be deleted rundll32 printui.dll,PrintUIEntry /q /in /n\\printerserver2\DC2250 rem Printer DC2250 added rundll32 printui.dll,PrintUIEntry /q /y /n\\printerserver2\DC2250 rem Printer DC2250 is now standartprinter rem now restart the spooler net stop spooler net start spooler
Now we have a look at the “rundll32 printui.dll,PrintUIEntry†commands we use
/dn – delete a Network printer
/n – name of the printer, full path is needed
/in – install a printer (driver have to be on the printer server)
/q – Quite installation, because we don't want the user to call in to tell us they got some “strange†messages
Be sure that everything is started fine, please restart the spooler service, last two lines of the logonscript. (that should be done not a “have toâ€).
Script is finished,now we place it to the Standard location on the domain controller
\\dc\NETLOGON\
Make sure that the user can accesse this file, if he can't it won't work
Okay now open the
MMC (Start->Run->mmc)
File → Add/remove Snapin
Add → AD Users and Computer → Add → Close → OK
Expand your domain and search your user (usually in the OU User)
Now got to the profile tab and add the name of the *.bat file youcreatedd (e.g. jdow.bat)
Should look like this:
Congratulation your done it, next time a user logon he get his network shares and the old printer are deleted and the new one appear as standard printer.
Sidebar
Wiki
Sidebar
Last blog posts
-
tivoli itm 6.2 change agent hostname to other then original system hostname
Tue 15 of Mar., 2011 19:17 CET
-
X11 secure display forwarding via ssh error
Tue 15 of Mar., 2011 19:03 CET
-
Android 2.2.1 delay between accepting call and actually hearing the caller
Tue 15 of Mar., 2011 18:50 CET
-
AIX: Get PVID directly from hdisk using od
Thu 15 of Apr., 2010 15:25 CEST
-
Power Blade: Add additional vscsi adapters to lpar / vhosts to vio server
Wed 24 of Mar., 2010 09:49 CET
-
Bug in xymon 4.3.3 Beta 2 splitncv
Tue 23 of Feb., 2010 10:11 CET
-
Analysing screen and browser window sizes reported by AWStats using R
Thu 18 of Feb., 2010 14:14 CET
-
Nagios on FreeBSD
Wed 27 of Jan., 2010 13:24 CET
-
Freebsd sendmail via Exchangeserver
Thu 17 of Dec., 2009 10:39 CET
-
xymon netapp vfiler quota monitoring
Tue 24 of Nov., 2009 17:55 CET
Last blog post comments
- Postfix sender address rewriting, changing mails "from" field in header on relay server: Sysadmin Jimbob Fri 03 of Feb., 2012 05:49 CET
- xymon installation tutorial ( formerly hobbit and bigbrother ): unix GPING Tue 24 of Jan., 2012 15:01 CET
- Android 2.2.1 delay between accepting call and actually hearing the caller: Good info Pharmd920 Tue 17 of Jan., 2012 13:25 CET
- Unix Color Terminal: Good info Pharma974 Sat 14 of Jan., 2012 03:39 CET
- Unix Color Terminal: Good info Pharmg936 Sat 14 of Jan., 2012 03:38 CET
- Unix Color Terminal: Good info Pharmg853 Sat 14 of Jan., 2012 03:37 CET
- Unix Color Terminal: Good info Pharmg490 Sat 14 of Jan., 2012 03:36 CET
- Unix Color Terminal: Good info Pharma756 Sat 14 of Jan., 2012 03:36 CET
- grep for a whole paragraph : AhVoyX , [url=http://kqktybpuksit.com/]kqktybpuksit[/url], [link=http://wuwcbscwywdy.com/]wuwcbscwywdy[/link], http://eagcveeedqkp.com/ cretcuzr Tue 20 of Dec., 2011 18:28 CET
- xymon netapp vfiler quota monitoring: EBVKOk , [url=http://ivrrcthzsmil.com/]ivrrcthzsmil[/url], [link=http://vzaimslyktkf.com/]vzaimslyktkf[/link], http://rslyzybrpzrp.com/ mzmeenwx Tue 20 of Dec., 2011 17:40 CET

Post new comment