Announcement

Collapse
No announcement yet.

setting Default Printer

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

  • setting Default Printer

    I have four XP pro machine installed printer manually. All computers are in AD domain. In printer and faxes there are few other printers like fax and pdf creator etc and HP001. These four machine are in one container called ABC. Now what i want to do is whoever (domain user) logs into these machine set the default pritner to HP001. I tried with bat and vbs putting them in programs-startup section it doesn´t work. however if i run manually it sets to default.

    Is there any script via GPO/login script or startup script just to set default printer only for this OU ?

    here is my bat file
    RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "HP001"

    All I want to do is set HP001 printer as default no matter who logs in for this OU (ABC)

    Thanks in advance

    cool guy

  • #2
    Re: setting Default Printer

    already searched the forums?
    I know there quite a few scripts here about this.
    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


    • #3
      Re: setting Default Printer

      Yes i did search in the forum but could not get it right one. can you point me in right place if you know - that will be great.

      cool guy

      Comment


      • #4
        Re: setting Default Printer

        http://forums.petri.com/search.php?searchid=1353568
        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


        • #5
          Re: setting Default Printer

          The 'default printer' setting is an User Configuration. There for, the group policy must be applied to the user accounts, by linking the GPO to the OU containing the userobject (or, to one of the ous/containers up the path till domain level, depending on all the locations of the userobjects).

          Use a vbscript to set the default printer,
          In the script, use this sample to determine first on which computer the user is logged-on and retrieve it's path in active directory (= the DN of the OU).
          And next in the sample, only the name of the OU is filtered from the complete path.

          Set the condition for the default printer like this;

          Code:
          Set objSysInfo = CreateObject("ADSystemInfo")
          computerDN = objSysInfo.ComputerName
          
          Set objComputer = GetObject("LDAP://" & computerDN)
          
          arrOUs = Split(objComputer.Parent, ",")
          MainOU = Split(arrOUs(0), "=")(1)
          
          If UCase(MainOU) = UCase("ABC") Then
           '<place your vbs code here to set a default printer>
          End if
          \Rems

          This posting is provided "AS IS" with no warranties, and confers no rights.

          __________________

          ** Remember to give credit where credit's due **
          and leave Reputation Points for meaningful posts

          Comment


          • #6
            Re: setting Default Printer

            Thanks - here is what i did according to your suggestion but did not get what i wanted.

            Set objSysInfo = CreateObject("ADSystemInfo")
            computerDN = objSysInfo.ComputerName

            Set objComputer = GetObject("LDAP://" & computerDN)

            arrOUs = Split(objComputer.Parent, ",")
            MainOU = Split(arrOUs(0), "=")(1)

            If UCase(MainOU) = UCase("ABC") Then
            objNetwork.SetDefaultPrinter("print24mc")
            End if

            It doesn´t set the default printer "print24mc"
            this computer are in city under ABC
            am i missing something ?

            Coolguy

            Comment


            • #7
              Re: setting Default Printer

              Originally posted by [url=http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_ahkp.mspx?mfr=true]www.microsoft.com/technet/scriptcenter/guide/sas_wsh_ahkp.mspx[/url]
              The WSH environment includes the built-in WScript object and three COM objects: WshShell, WshNetwork, and WshController. Your scripts can use these objects to help automate system administration tasks.

              The 'WshNetwork object' provides your scripts with the ability to work with network drives and printers.
              To access an object, you must create an instance of the object in your script, then you are also able to give the object instance a name that you can use in your script (in your script the object has been given the name 'objNetwork').

              You were close, you use 'objNetwork' for the 'SetDefaultPrinter' method, but 'objNetwork' was not created yet.
              Just add this statement to your script;
              Set objNetwork = WScript.CreateObject("WScript.Network")

              - http://www.microsoft.com/technet/scr....mspx?mfr=true


              \Rems


              - EDIT -
              this computer are in city under ABC
              What is City, is it an other OU?
              If you want to include also all subOUs under "ABC" (?) then you must use the InStr() function
              Code:
              strOUname = "OU=ABC"
              
              Set objSysInfo = CreateObject("ADSystemInfo")
              computerDN = LCase(objSysInfo.ComputerName)
              strOUname = LCase("," & strOUname & ",")
              
              If (InStr(computerDN,strOUname)<>0) Then
               '<place your vbs code here to set a default printer>
              End if
              Note: A single name of an OU is not a unique identifier in the Active Directory!
              If there are other OUs with also the name "ABC" in the Active Directory and they also contains computeraccounts below it, the script acts the same for those computers.
              (To avoid that, adjust the script so it use only the Distinguest Name of the OU)
              Last edited by Rems; 30th January 2008, 17:48.

              This posting is provided "AS IS" with no warranties, and confers no rights.

              __________________

              ** Remember to give credit where credit's due **
              and leave Reputation Points for meaningful posts

              Comment


              • #8
                Re: setting Default Printer

                To bad you don't even bother to use the search engine..
                It's already been questioned before.

                For example and this are just a few scripts:
                http://forums.petri.com/showthread.p...efault+printer
                http://forums.petri.com/showthread.p...efault+printer
                http://forums.petri.com/showthread.php?t=11901
                http://forums.petri.com/showthread.p...efault+printer
                http://forums.petri.com/showthread.php?t=404
                Last edited by Dumber; 30th January 2008, 00:48.
                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