Windows server 2003 and Windows XP – How to add printer via script

Posted by aidas | Posted in Scripting, Windows 2003, Windows XP | Posted on 16-06-2009

0




In this post i`ll show one of many ways how to connect your users to shared printer. For that open notepad in Windows server 2003 or Windows XP and type:

REM Add Printers
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\sever\printername1
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\sever\printername2

REM Set Default Printer
RunDll32.EXE printui.dll,PrintUIEntry /y /n \\server\printername2
EXIT

For example i have two shared printers on server named “Fileserver” and these printers are shared as “HPLJ1″ and “HPLJ2″. Also i want “HPLJ1″ as default printer for all users. I will type :

REM Add Printers
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\Fileserver\HPLJ1
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\Fileserver\HPLH2

REM Set Default Printer
RunDll32.EXE printui.dll,PrintUIEntry /y /n \\Fileserver\HPLJ1
EXIT

Save this file as Addprinter.bat and place it as login script via group policy or you can deploy it to your users in any other way you prefer.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Blogosphere News


Follow us on Twitter !
Follow us on Twitter!


Write a comment