Announcement

Collapse
No announcement yet.

Printer Scripting

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

  • Printer Scripting

    Hi does anyone have a Script for connecting to a set of printers at logon.

    I have 5 terminal servers and a Single server for handling Print jobs. There is then 5 printers connected to this Print Server.

    What i am looking for is a script that will run at logon and connect the user to all 5printers and set one of them as a default printer.

    I have tried the following:

    ' VBScript.
    Dim net
    Set net = CreateObject("WScript.Network")
    net.AddWindowsPrinterConnection "\\Legolas\IT1"

    Set net = CreateObject("WScript.Network")
    net.AddWindowsPrinterConnection "\\Legolas\IT2"

    Set net = CreateObject("WScript.Network")
    net.AddWindowsPrinterConnection "\\Legolas\IT3"

    Set net = CreateObject("WScript.Network")
    net.AddWindowsPrinterConnection "\\Legolas\IT4"

    Set net = CreateObject("WScript.Network")
    net.SetDefaultPrinter "\\Legolas\IT4"

    which for me as an administrator works fine but generates errors for everyone else....


    Please could someone help.

    Many thanks

  • #2
    Re: Printer Scripting

    Firstly you only need to 'set' net once. And secondly what are the errors that non-administrators get?

    Have you tried running by going to the command prompt and typing:

    Code:
    cscript addprinters.vbs
    If so whats the error message then?
    Server 2000 MCP
    Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

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

    Comment


    • #3
      Re: Printer Scripting

      Hi,

      I have the same problem. The error which users met is : Access denied.
      Domain users is a member of local Users on the workstations.
      Love in vain is better than love no one.

      Comment


      • #4
        Re: Printer Scripting

        Have you tried as an admin? I presume that works ok. Please post your script. Although i doubt it is a script issue. It will be a permissions problem. Our standard users have a VB script that runs on logon matching printers to computers and it works fine. They have no special rights.
        Server 2000 MCP
        Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

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

        Comment


        • #5
          Re: Printer Scripting

          Certaintly, with admin, it's OK.

          I used this Script AddPrinters.vbs

          Set WshNetwork = CreateObject("WScript.Network")
          set WshShell = CreateObject("WScript.Shell")
          Set oPrinters = WshNetwork.EnumPrinterConnections
          Dim WshShell, WshNetwork, BtnCode, printthere, iprinter
          iprinter = "no"

          '################## Put the printers exact path and name here. It is case sensative.

          printthere = "\\printserver\EPSON EPL-6100L Advanced"

          '##################


          '####This goes thru the names of printers installed, if it finds the one you want iprinter changes to yes
          For i = 0 to oPrinters.Count - 1 Step 2
          if oPrinters.Item(i+1) = printthere THEN iprinter = "yes"
          Next

          '####If the printer is installed the script does nothing. If it isn't, it's installed.
          IF iprinter = "yes" THEN
          'doing nothing
          ELSEIF iprinter = "no" THEN
          WshNetwork.AddWindowsPrinterConnection Printthere
          WshNetwork.SetDefaultPrinter Printthere
          WScript.Quit
          END if


          I'm not a scripter so I found this script on a certain forum. Thank the author.
          Love in vain is better than love no one.

          Comment


          • #6
            Re: Printer Scripting

            What line does it fail on?
            Server 2000 MCP
            Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

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

            Comment


            • #7
              Re: Printer Scripting

              also search this forums..

              http://forums.petri.com/showthread.php?t=404

              this script works for me.
              Marcel
              Technical Consultant
              Netherlands
              http://www.phetios.com
              http://blog.nessus.nl

              MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
              "No matter how secure, there is always the human factor."

              "Enjoy life today, tomorrow may never come."
              "If you're going through hell, keep going. ~Winston Churchill"

              Comment


              • #8
                Re: Printer Scripting

                Hi,

                Thanks for the replies,

                The script work well for administrators. Couldn't work for users because access denied. I think the line get access denied right is : WshNetwork.AddWindowsPrinterConnection Printthere
                Thanks for your link, Dumber, I will try it.
                Love in vain is better than love no one.

                Comment

                Working...
                X