Link to home
Start Free TrialLog in
Avatar of bbayachek
bbayachek

asked on

group policy default deploying printers by computer settings

I know how to deploy printers via group policies via computer or user settings. It seems like I cannot deploy a shared printer via computer settings and cannot set the printer as the default printer like I can do with user settings.

I have labrooms that need 4 printers installed with one set as the default. I do not want to do it by a user setting.  

I have windows server 2008 r2 and windows 7 as the client.

Thank you
ASKER CERTIFIED SOLUTION
Avatar of kevinhsieh
kevinhsieh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You should now be able to set the user group policy under each lab room OU to force a particular printer to be default in that room.
http://blogs.technet.com/b/grouppolicy/archive/2009/06/24/gp-preferences-set-a-default-printer.aspx


If that doesn't work, you could try setting group policy VBscripts in the OU.  I don't have the code anymore, but, long ago, I set 2 VBscripts to do that in group policy for Windows 2000 Server.

The first script was set on the computer GPO and just basically set an environment variable for the room name.  You'll have to load the script onto the server.  Is was very simple, something along the lines of this:
Dim file_path As String 
    ' Set an environment variable.
    SetEnvironmentVariable "LabRoom", "ROOM1"
End Sub

Open in new window


The 2nd script was set on the user account GPO and read the environment variable and added the printer for the room as the default printer.  If the user already had the printer in their profile it becomes the default.  I don't have a Windows machine handy to test, but you would use GetEnvironmentVariable and then use code example from the following site with a case statement to set it.
http://www.vbforums.com/showthread.php?777897-RESOLVED-How-to-Set-Windows-Default-Printer&s=7cf26a4f4562c464832eec1d6acd4ba9

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        ComboBox1.Items.Clear()
        For Each printer As String In Printing.PrinterSettings.InstalledPrinters
            ComboBox1.Items.Add(printer)
        Next printer

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        If Me.ComboBox1.SelectedItem IsNot Nothing Then
            'set the printer name
            Me.PrintDocument1.PrinterSettings.PrinterName = ComboBox1.SelectedItem
            'and print it
            Me.PrintDocument1.Print()

        End If
    End Sub

    Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

        Using br As New SolidBrush(Color.Black)
            e.Graphics.DrawString("printed", Me.Font, br, New Point(10, 10))
        End Using

    End Sub

Open in new window

@serialband,  user settings in GPO only apply to user objects in AD. You can't apply them to a computer OU and have anything happen unless the user is in the OU also,  or group policy loopback processing is enabled. If you applied to the user's OU, then they would always get those settings,  which OP probably doesn't want as this is only for the computer lab.
Avatar of bbayachek
bbayachek

ASKER

We have issues with login time with loop back. Loop back causes many issues.