Announcement

Collapse
No announcement yet.

Default printer is not retained in windows xp

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

  • Default printer is not retained in windows xp

    Hi everyone,

    The default printer setting in some users is not retained, it switches back to a default printer. In our logon script we have automatically instaled some printers that are created when a user logs on, all the users get all the shared printers.

    However there are some users that use a private printer which we added manually to the pc.

    Now here is the weird thing. These users change their default printer to the private printer, but every time when these users log off and on again it switches to a different default printer but not the one they selected. How can I change this? Could it be something ion the logon script?

  • #2
    Re: Default printer is not retained in windows xp

    Yes it could be something in the script. You will need to post the script so the scripting guys can look at it.
    1 1 was a racehorse.
    2 2 was 1 2.
    1 1 1 1 race 1 day,
    2 2 1 1 2

    Comment


    • #3
      Re: Default printer is not retained in windows xp

      We have found this. It seemed to set the default as the one which was alphabetically first.

      We used :

      Code:
      Dim oNetwork
      Set oNetwork = CreateObject("WScript.Network")
      oNetwork.SetDefaultPrinter "\\strefi\a8-draft-hp4100dtn"
      ..to set the default printer in a vbs script.

      Hope this helps
      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


      • #4
        Re: Default printer is not retained in windows xp

        Hi,

        This is the script. I just modified teh names. Is the mistake here somewhere??


        Dim objShell, processEnv, logonServer, colSysEnvVars, strDefPrinter, PrinterPath, WshNetwork, rc

        Set objShell = WScript.CreateObject("WScript.Shell")
        Set processEnv = objShell.Environment("Process")
        Set colSysEnvVars = objShell.Environment("SYSTEM")

        strDefPrinter = "\\Serverdc1\" + colSysEnvVars("Def_Printer")
        logonServer = processEnv("LogonServer")
        Set WshNetwork = WScript.CreateObject("WScript.Network")

        If WshNetwork.ComputerName = "server3" Then
        Else
        If (LCase(Left(logonServer, 5)) = "\\serv") Then


        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer10")
        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer9")
        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer20")
        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer1")
        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer2")
        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer3")
        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer4")
        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer5")
        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer6")
        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer7")
        WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer8")


        If Len(strDefPrinter) <> 12 Then
        WshNetwork.SetDefaultPrinter strDefPrinter
        End If
        End If

        If (LCase(Left(logonServer, 5)) = "\\ser") Then
        ' Here the server2 printers
        WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer11")
        WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer12")
        WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer13")
        WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer14")
        WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer15")
        WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer16")
        WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer17")
        WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer18")
        End If
        End If

        Comment


        • #5
          Re: Default printer is not retained in windows xp

          Dim objShell, processEnv, logonServer, colSysEnvVars, strDefPrinter, PrinterPath, WshNetwork, rc

          Set objShell = WScript.CreateObject("WScript.Shell")
          Set processEnv = objShell.Environment("Process")
          Set colSysEnvVars = objShell.Environment("SYSTEM")

          strDefPrinter = "\\Serverdc1\" + colSysEnvVars("Def_Printer")
          logonServer = processEnv("LogonServer")
          Set WshNetwork = WScript.CreateObject("WScript.Network")

          If WshNetwork.ComputerName = "server3" Then
          Else
          If (LCase(Left(logonServer, 5)) = "\\serv") Then


          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer10")
          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer9")
          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer20")
          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer1")
          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer2")
          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer3")
          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer4")
          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer5")
          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer6")
          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer7")
          WshNetwork.AddWindowsPrinterConnection("\\Server1d c1\printer8")


          If Len(strDefPrinter) <> 12 Then
          WshNetwork.SetDefaultPrinter strDefPrinter
          End If
          End If

          If (LCase(Left(logonServer, 5)) = "\\ser") Then
          ' Here the server2 printers
          WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer11")
          WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer12")
          WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer13")
          WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer14")
          WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer15")
          WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer16")
          WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer17")
          WshNetwork.AddWindowsPrinterConnection("\\server2d c1\printer18")
          End If
          End If

          Comment


          • #6
            Re: Default printer is not retained in windows xp

            Are you using roaming profiles?
            Regards,
            Jeremy

            Network Consultant/Engineer
            Baltimore - Washington area and beyond
            www.gma-cpa.com

            Comment


            • #7
              Re: Default printer is not retained in windows xp

              Hi there,


              No the profiles are all local, but for some reason when a user sets his default printer to a different one, it switches back again.

              Comment


              • #8
                Re: Default printer is not retained in windows xp

                Dave,

                Are you sure you're post the complete script?
                Also please see this thread where you can find another printer script.

                http://forums.petri.com/showthread.p...hlight=Printer

                Personally i would change this part:

                Code:
                If Len(strDefPrinter) <> 12 Then
                WshNetwork.SetDefaultPrinter strDefPrinter
                End If
                End If
                Edit; if it's a scripting issue I will move it to the scripting forum
                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


                • #9
                  Re: Default printer is not retained in windows xp

                  Hi Marcel,


                  yeah I definitely have, I will try your suggestion. May I ask what the difference is?



                  Kind regards


                  David

                  Comment


                  • #10
                    Re: Default printer is not retained in windows xp

                    BTW, the prob may be this:

                    If (LCase(Left(logonServer, 5)) = "\\serv") Then
                    as \\serv is 6 characters long thus always false thus the SetDefaultPrinter bit never runs.

                    P.S., This does appear to be a scripting issue so a move to that forum may be in order.

                    P.P.S., I'd also change

                    If Len(strDefPrinter) <> 12 Then
                    to

                    If LCase(Left(strDefPrinter, 5)) <> "\\ser" Then
                    as you have different length printer names and the objective as I recall was to restore a non-server default printer.
                    Last edited by rvalstar; 14th December 2006, 09:03. Reason: Added P.S. and now P.P.S.
                    Cheers,

                    Rick

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

                    2006-2099 R Valstar. This post is offered "as is" for discussion purposes only with no express or implied warranty of any kind including, but not limited to, correctness or fitness for use. Nothing herein shall be construed as advice. Attempting any activity based on information in this post is done at your own risk.

                    Comment


                    • #11
                      Re: Default printer is not retained in windows xp

                      indeed. Moved to Scripting.
                      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

                      Working...
                      X