Announcement

Collapse
No announcement yet.

Adding Network Printers for All Users

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding Network Printers for All Users

    I have just been involved in a roll-out of Windows 7 in a college environment over the summer. Apart from a few teething problems it has gone reasonable well.

    However, one area of the college, the library we have a particular problem. This concerns printers that are shared from a win 2003 server that need to be added to all the machines for multi users. Unfortunately there are a number of stumbling blocks and are as follows:

    The printers cannot be installed as local printers as the users pay per sheet depending upon whether it is a colour printout or grey scale and they also go through a print command application that can administered by the library staff.

    There is only one physical printer which has been installed twice and are named fieryblack and fierycolour. This somehow allows staff at the command workstation to determine if a printout is colour or black.

    The printers must default for all users to the fieryblack

    So far I have managed to install the printers using the following commands:

    rundll32 printui.dll,PrintUIEntry /ga /n\\UNC-path-to-the-printer-black

    rundll32 printui.dll,PrintUIEntry /ga /n\\UNC-path-to-the-printer-Colour

    net stop spooler

    net start spooler

    However since the printer is one and the same, it was difficult to control which one became the default as some users would get the black and some would get the colour. To get round this I inserted a batch file to all users at log in with the following command:

    rundll32 printui.dll , PrintUIEntry /y /n\\UNC-path-to-the-printer-black

    This would generally reinforce the printer to default to black

    Now, 90% of the time this works ok but on some occasions when a user logs on they do not get any printers showing, something to do with the printer spooling service perhaps, sometimes the user will still get the printer defaulting to the colour printer. There are other symptoms depending upon whether the printer is on before the pc's as it is switched off every night, there may well also be a power save mode that kicks in and results in printers showing as being offline when in fact it is on-line.

    I know many people previously used to copy profiles over to the default machine profile which added the printers to whoever logged into the machine however I am not a fan, and have seen some major corruption and failures during the sysprep process when creating the image of a machine and corrupt log in profiles if added after the machine has been deployed.

    My main question is , how have others implemented shared network printers in a multi user environment and how successful has it been.

  • #2
    Re: Adding Network Printers for All Users

    If you have 2008 servers you can use print managemetn to deploy printers via group policy

    If you have 2008 DCs you can use Group Policy Preferences to deploy them
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: Adding Network Printers for All Users

      Jewen-

      I have used the approach you mentioned with a great deal of success in a primarily Win XP environment. To my knowledge it should work with Win 7 clients as well. I have cobbled together a Powershell script that automates the process:
      Code:
         # Definition of Variables
        $WorkingDir="D:\LOCATION\"
        $ClientList=Get-Content ($WorkingDir+"comps.txt")
        $ActiveToProcess=$WorkingDir+"online.txt"
        
        # Generate the Client List to Process
        # by Checking the Client's Availability via a Ping Request
        
        ForEach ($Nodein$ClientList){
        $QueryString= ('Select StatusCode From Win32_PingStatus Where Address =
        "'+$Node+'"')
        $ResultsSet=Get-WmiObject -Q$QueryString
        
        If ($ResultsSet.StatusCode -Eq 0)
        {write-output$Node |out-file ($WorkingDir+"online.txt") -append}
        Else
        {write-output$Node |out-file ($WorkingDir+"offline.txt") -append}
        }
        
        # Give the Clients the new Printer Queues
        
        ForEach ($ClientinGet-Content$ActiveToProcess){
        $p= [WMICLASS]"//$Client/root/CIMv2:WIN32_Process"
        trap { ( 'Error: {0}'-f$_.Exception.Message) | 
        Out-File ($WorkingDir+"dud.txt") -Append ; continue} 
        
        # Printer Number One
        $p.Create("rundll32 printui.dll, PrintUIEntry /ga /n\\UNC")
        #  $p.Create("rundll32 printui.dll, PrintUIEntry /gd /n\\UNC")
        
        Start-Sleep-s 20  # Number following the -s is in seconds
        
        # Printer Number Two
        $p.Create("rundll32 printui.dll, PrintUIEntry /ga /n\\UNC")
        #  $p.Create("rundll32 printui.dll, PrintUIEntry /gd /n\\UNC")
        
        Start-Sleep-s 20  # Number following the -s is in seconds
        
        # Restart the Printer Spooler Service for changes to take effect
        $svc=Get-WmiObjectWin32_Service-ComputerName$Client`
        -Filter"name='Spooler'"
        if ($svc.started -eq$true) {
        $svc.StopService()
                    }
        $svc.StartService()
        }
        
        # Clean up files
        Remove-Item ($WorkingDir+"online.txt")
      The /ga and /gd switches can be used to GlobalAdd or GlobalDelete the queues. It is important to note that once added this way, the queues can only be deleted by manually deleting reg keys or by using the /gd switch. Simply deleting the queue will not work (it reappears).

      I built in some functionality into the script to ping the client machine first. This is helpful to do so you don't waste time on trying to hit clients that are offline. A text files will output a list of offline clients, which can be used to run the script against at a later pass.

      Hope this helps.

      Peace
      Last edited by Rems; 21st September 2010, 17:50.

      Comment


      • #4
        Re: Adding Network Printers for All Users

        Looks very good (although I need sunglasses to fully appreciate it )

        Rep++
        Tom Jones
        MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
        PhD, MSc, FIAP, MIITT
        IT Trainer / Consultant
        Ossian Ltd
        Scotland

        ** Remember to give credit where credit is due and leave reputation points where appropriate **

        Comment


        • #5
          Re: Adding Network Printers for All Users

          Hi there,

          Thanks for the replies. The power shell script looks interesting and will investigate its use once I have a bit more time. I am in the middle of a building move at the moment so it's difficult to get time to test.

          I have also looked at the GPO option however we are currently running Windows 2003 not R2 unfortunately and definitely not 2008. I suspect this would be the easiest option long-term.

          Cheers

          Jewen.

          Comment


          • #6
            Re: Adding Network Printers for All Users

            Developing into a scripting thread here, but I've found Prnmngr.vbs to be a lot easier to use than rundll32. Using this method the first printer you list in the script is automatically set as the default IIRC.
            BSc, MCSA: Server 2008, MCSE, MCSA: Messaging, MCTS
            sigpic
            Cruachan's Blog

            Comment


            • #7
              Re: Adding Network Printers for All Users

              I know this a old thread however I thought I would come back with some information on how I have resolved this issue.

              Unknown to me there was a setting in the gpedit.msc console, under Computer configuration where you can deploy printers to a machine therefore whoever logs on will get the desired printers.

              Basically my solution was to install the deired printers to one user which will prompt to install the drivers from the printer or printers and then navigate to the gpedit.msc console and deploy the same printers to the computer. I then added a the batch file to the logon scripts location to reinforce the printer that was required to be the default for all users.

              This has been quite sucessful especially when installing a printer on the network on machines where there is multi user/ job share environment. It avoids revisiting a machine to install the printer for the user who was not there at the time of the initial install.

              Overall, I still think that a GPO applied from the server would be the best solution as mentioned in previous posts, but until the day the Network Admins move to 2008 it will have to do.

              Cheers

              jewen.

              Comment

              Working...
              X