Leave the Default Printer Alone

Discussion in 'Scripting' started by Karlow34, Sep 8, 2005.

  1. Karlow34

    Karlow34 Guest

    Am currently deploying printers to users depending on Group membership with a
    script, and am seeing the following behavior.

    If a Locally attached printer is set as "Default Printer", then one of the
    Network Printers becomes the default printer at login, when the login script
    runs.

    If a Network Printer is defined as the Default Printer, then it is left
    alone at logon.

    Is there a way to leave the locally attached printer as the Default without
    having to define it locally for each machine individually?

    Please advise.....
     
    Karlow34, Sep 8, 2005
    #1
    1. Advertisements

  2. Karl,

    Could you post the code section where you set the printer? And what are
    these computers running?

    I'm assuming you're using WSH 5.1 or 5.6 on 2000/XP, but I don't know how
    you're setting the printer. To my knowledge, neither
    AddWindowsPrinterConnection nor AddPrinterConnection will set a printer as
    the default - you would normally have to call SetDefaultPrinter explicitly.
     
    Alex K. Angelopoulos \(MVP\), Sep 9, 2005
    #2
    1. Advertisements

  3. Karlow34

    Karlow34 Guest

    Roger that, I'll get it posted up in the morning.

    Thanks for your response.
     
    Karlow34, Sep 9, 2005
    #3
  4. Karlow34

    Karlow34 Guest

    Thank you very much for your reply.

    I was able to find the code section as follows and simply removed it. This
    made the customer very happy this morning.



    Next


    '* If the current user is a member of the group associated with the
    printer and the
    '* registry entry does not exist install the printer, add the
    appropriate entries to
    '* the registry, and add an entry to the Application log stating the
    addition of the printer
    If isgroupmember AND Not RegValueExists Then
    objNetwork.AddWindowsPrinterConnection GroupArray(i,1)
    objNetwork.SetDefaultPrinter GroupArray(i,1)
    WshShell.RegWrite "HKCU\Printers\InstalledPrinters\" &
    printername, "Yes", "REG_SZ"
    WshShell.LogEvent 4, "The printer " & GroupArray(i,1) & "
    was installed for " & ldapusername & " successfully using the login script."
    End if



    Thanks much for the assist
     
    Karlow34, Sep 9, 2005
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.