5 Replies Latest reply on Apr 18, 2013 1:25 PM by Terrell Davis

    How To Set The Default Printer on client machine

    Terrell Davis Newbie

      I would like to know how you guys are setting the default printer on client machines. Is there a way to build an install package to set a printer as default? We have a color printer and a b/w. We used to use a script that we developed to accomplish this task, but it no longer works, and the machines that it does work on, it works only half the time. We have an enterprise environment, and we use active directory for user login/authentication. Is there a group policy associated with this that I am not aware of? We manage 10 labs each has about 50 machines, so any help would be greatly appreciated. Thanks

        • Re: How To Set The Default Printer on client machine
          Newbie

          go to a cmd window and type rundll32 printui.dll,PrintUIEntry /? 

           

          review the list of switches and you can build a line of code to set you printer as default. You can then run as a sctript in a GPO or other type of control.

           

          Example

          rundll32 printui.dll,PrintUIEntry /y /n "<printername>"

          • Re: How To Set The Default Printer on client machine
            Nic Meadows Pioneer

            If you can work out a script using VBS or WMI to work you can include it in a Custom module as part of the package. I've only ever done it using VBS

             

            The VB script goes something like this

             

            Option Explicit
            Dim oNetwork, oNetwork1, sPrintPath
            'msgbox "adding Printer",vbokonly

             

            Set oNetwork = CreateObject("WScript.Network")
            '-- Add the Full windows UNC printer pathname  below --
            sPrintPath = "\\stserver\Black&White"
            oNetwork.SetDefaultPrinter sPrintPath

             

            '--
            Clean Up
            Set oNetwork =Nothing

             

            You need to save the VBS as file and include it in custom module along with a bat file which calls the vbs using WSCRIPT.

             

            Regards

             

            Nic

            1 of 1 people found this helpful
              • Re: How To Set The Default Printer on client machine
                Josh Lander Wayfarer

                I had the same issue with our main lab, bw and color.  There are lots of ways to accomplish this.  Group Policy Prefernce, if your on Windows 7 is one of them, or you can do it the old fashioned way.

                 

                We ended up using a .bat with the follwing commands.

                 

                batch

                @ECHO OFF

                regedit.exe /s "\\servername\Scripts\logon\DefaultPrinterLLB11.reg"

                cls

                 

                reg key

                Windows Registry Editor Version 5.00

                 

                [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows]

                "Device"="LLB11-BW,winspool,Ne00:"

                 

                We apply the .bat via group policy on login for the students.

                 

                1 of 1 people found this helpful
                  • Re: How To Set The Default Printer on client machine
                    Newbie

                    We used a batch script for our lab to change the printer setup around.  probably a lot more than what is posted above, but it saved me a lot of time.  We used it as a logon script one time.

                     

                    Look for the default printer in the script.  We also change the names of the printers.  I install on my master machine, change the name of the printer, and then the name of the key to reflect the name of the printer.

                     

                    hope it comes acrooss.  We are trying to do this in powershell too (probably be only 2 lines of code)

                     

                    @echo off

                    REM WINDOWS 7 client pc bat
                    REM DELETE, Install, Set Default Printer, all-one-none
                    REM Change location of prnmngr for windows XP machines

                     

                    REM ********************************************************************
                    REM This will remove selected printers - not the port
                    REM Then install the printers needed
                    REM To install more printers then copy from setlocal to the bottom and
                    REM paste it below changing the installername as needed
                    REM *********************************************************************
                    REM NOTES:
                    REM I put in the pauses because when running as a start script, not every
                    REM computer has been picking it up and by putting in the pause I can see
                    REM the computers have pulled the script. If not, then I log off the pc
                    REM not restart it remotely with powershell and it will pick it up and run
                    REM **********************************************************************

                     

                    rem ******************************
                    rem          Delete Printers
                    rem ******************************

                    c:

                    cd C:\Windows\System32\Printing_Admin_Scripts\en-US

                    rem ***************************************************
                    rem              black and white printers
                    rem ***************************************************

                    cscript prnmngr.vbs -d -p "xxx paused on pharosservername"

                    cscript prnmngr.vbs -d -p "xxx paused on pharosservername"

                    cscript prnmngr.vbs -d -p "xxx paused on pharosservername"

                    cscript prnmngr.vbs -d -p "xxx paused on pharosservername"

                    cscript prnmngr.vbs -d -p "xxx paused on pharosservername"

                    cscript prnmngr.vbs -d -p "xxx"

                    cscript prnmngr.vbs -d -p "xxx"

                    cscript prnmngr.vbs -d -p "xxx B&W Printers"

                    cscript prnmngr.vbs -d -p "xxx B&W Printers"

                    rem ****************************************************
                    rem                  color printers
                    rem ****************************************************

                    cscript prnmngr.vbs -d -p "xxx paused on pharosservername"

                    cscript prnmngr.vbs -d -p "xxx paused on pharosservername"

                    cscript prnmngr.vbs -d -p "xxx COLOR"

                    cscript prnmngr.vbs -d -p "xxx Color Printer"

                    cscript prnmngr.vbs -d -p "xxx COLOR"

                    cscript prnmngr.vbs -d -p "xxx Color Printer"

                    REM pause

                     

                    rem **************************************
                    rem         Install pharos printer
                    rem **************************************

                    c:

                    setlocal

                    REM *************************************************************************
                    REM Environment customization begins here. Modify variables below.
                    REM Deployserver is the path to the installer folder
                    REM *************************************************************************

                    REM Set DeployServer to a network-accessible location containing the Uniprint installer

                    set DeployServer=\\ad server\netlogon\pharos

                    REM ************************************************************************
                    REM Installername is the executable
                    REM Change the installername to the printer package name
                    REM ************************************************************************

                    REM Set InstallerName to the name of your copy of the Silverlight installer

                    set InstallerName=xxxPrinter1_for_W2K.exe

                    REM *************************************************************************
                    REM LogLocation is where you want a list of pc's that worked
                    REM Location must be a share the account used to install has r/w access to
                    REM *************************************************************************

                    REM Set LogLocation to a central directory to collect log files.

                    rem Set LogLocation=\\xxx\pharos

                    REM *************************************************************************
                    REM Deployment code begins here.
                    REM *************************************************************************

                    REM begin install

                    start /wait %DeployServer%\%InstallerName% -quiet
                    rem echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt
                    rem copy c:\users\xxx\appdata\local\temp\pharos\controllerlog.txt %loglocation%\%computername%.txt

                    REM  disregard i think If 0 or other was returned, the product was found or another error occurred. Do nothing.
                    :End

                    Endlocal

                    rem **************************************
                    rem         Install pharos printer 2
                    rem **************************************

                    c:

                    setlocal

                    REM *************************************************************************
                    REM Environment customization begins here. Modify variables below.
                    REM Deployserver is the path to the installer folder
                    REM *************************************************************************

                    REM Set DeployServer to a network-accessible location containing the Uniprint installer

                    set DeployServer=\\ad server\netlogon\pharos

                    REM ************************************************************************
                    REM Installername is the executable
                    REM Change the installername to the printer package name
                    REM ************************************************************************

                    REM Set InstallerName to the name of your copy of the Silverlight installer

                    set InstallerName=xxx_for_W2K.exe

                    REM *************************************************************************
                    REM LogLocation is where you want a list of pc's that worked
                    REM Location must be a share the account used to install has r/w access to
                    REM *************************************************************************

                    REM Set LogLocation to a central directory to collect log files.

                    rem Set LogLocation=\\xxx\pharos

                    REM *************************************************************************
                    REM Deployment code begins here.
                    REM *************************************************************************

                    REM begin install

                    start /wait %DeployServer%\%InstallerName% -quiet
                    rem echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt
                    rem copy c:\users\xxx\appdata\local\temp\pharos\controllerlog.txt %loglocation%\%computername%.txt

                    REM  disregard i think If 0 or other was returned, the product was found or another error occurred. Do nothing.
                    :End

                    Endlocal

                    REM pause

                    REM *************************************************************************
                    REM                  Set the default Printer here
                    REM *************************************************************************

                    c:

                    cd C:\Windows\System32\Printing_Admin_Scripts\en-US

                    cscript prnmngr.vbs -t -p "xxx paused on pharosservername"

                    REM cscript prnmngr.vbs -t -p "xxx paused on pharosservername"

                    REM pause

                     

                    REM **********************************************************************
                    REM                Rename Printers in Windows
                    REM **********************************************************************

                    c:

                    cd C:\Windows\System32\Printing_Admin_Scripts\en-US

                    REM ***** xxx Printers *****

                    cscript prncnfg.vbs -x -p "xxx paused on pharosservername" -z "xxx B&W Printers"

                    cscript prncnfg.vbs -x -p "xxx paused on pharosservername" -z "xxx Color Printer"

                    REM ***** Classroom Printers *****

                    REM cscript prncnfg.vbs -x -p "xxx paused on pharosservername" -z "xxx B&W Printers"

                    REM cscript prncnfg.vbs -x -p "xxx paused on pharosservername" -z "xxx Color Printer"

                    REM pause

                    REM ******************************************************************
                    REM        Change Pharos registry to reflect new printer names
                    REM          DELETES ALL REGKEYS AND RE-ADDS WITH NEW NAMES
                    REM ******************************************************************

                    c:

                    setlocal

                    REM Set DeployServer to a network-accessible location containing the REG key

                    set DeployServer=\\ad servername\netlogon\pharos\regkeys

                    regedit.exe /s %deployserver%\pharos-xxx.reg

                    REM regedit.exe /s %deployserver%\pharos-xxx.reg

                    pause

                    exit

                    1 of 1 people found this helpful