Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you automatically install printers via Group policy???

Status
Not open for further replies.

joepc

MIS
Jul 26, 2002
647
0
0
US
Anyone know of way to install printers in Group Policy?
 
Yes. Check the VBS forum, forum329, for scripts that will do this. You can tie those into a GPO.

Pat Richard, MCSE MCSA:Messaging CNA
Microsoft Exchange MVP
Want to know how email works? Read for yourself -
 
As Pat mentioned, there are many solutions for this in VBS that you can tie to a logon script that is applied to a GPO.

There is also another possibilty. If you are using Windows server 2003. If you upgrade to server 2003 R2 there are some new tools for deploying printers that can be added to thye administration tools. Oh, I should also mention upgrading to R2 also requires you to extend the active directory to use the neat new admin tools.

Here is a snippet of code that I have been playing with to map printers based on group memberships that may help you.
Most of it pieced together from various scripts you can find here.

Code:
' On Error Resume Next

'3 initial object creation
Dim strDomain, strUser ' (Declare variables at top)
Dim WSHNetwork, objGroup , UserObj

Set WSHShell = CreateObject("WScript.Shell")
set objNetwork = WScript.createObject("WScript.Network")

DomainString = objNetwork.UserDomain
UserString = objNetwork.UserName

Set UserObj = GetObject("WinNT://" & objNetwork.UserDomain & "/" & UserString)

'Welcome Message
'MsgBox "Welcome to the " & DomainString & " Network, " & UserString & "!"

Sub MapPrinters(UserString)
'This is set at the top of the script.
	'set objNetwork = WScript.createObject("WScript.Network")

'Now check for group memberships and select the correct Case
strCounter = 0 ' Initialize counter
For Each GroupObj In UserObj.Groups
    WScript.Echo UCase(GroupObj.Name) ' (Insert echo command for troubleshooting)

    Select Case UCase(GroupObj.Name) ' Convert to Upper Case for consistency
    
    'Check for group memberships and take needed action

        Case "025"
            If strCounter > 0 Then
                WScript.Echo "User is member of multiple banks"
                Exit For ' Causes For...Next loop to end
            Else
                strCounter = strCounter + 1 ' Increment counter for next loop
            End If
            objNetwork.SetDefaultPrinter "\\LXOLCDPRN01\First Floor C450"

        Case "052"
            If strCounter > 0 Then
                WScript.Echo "User is member of multiple banks"
                Exit For ' Causes For...Next loop to end
            Else
                strCounter = strCounter + 1 ' Increment counter for next loop
            End If
            objNetwork.SetDefaultPrinter "\\LXOLCDPRN01\Second Floor C450"
Next


hope this helps.

Thanks

John Fuhrman
Titan Global Services
 
We currently have a logon script which adds printers using VBS, and I'm not particularly keen on it as every time it runs, it deletes the printers and then re-adds them again. Which firstly I feel is very wasteful and also means that users can't make changes to their printing preferences because next time they log in, the printer is re-added so preferences are lost. So learn from our mistakes :)If your printers are going to change alot, maybe add some versioning to the script so that printers only get deleted when they need to be.

As for pushing them out with 2003 R2 - I done this recetnly for a new office which we opened, as I thought it would be a major improvement on using script. But I was dissappointed - you still need to have pushprinterconnections.exe as a logon or startup script - depending on whether you push the printers to users or computers. I also found that if you deleted printers, you had to restart the computer twice before the client updated (I pushed them to computers). That said, the print management in R2 does have other functionality, such as searching your network for printers etc - which is quiet useful.

Anyway, that's my rant over !! Just my 2 cent for what it's worth

Good Luck

Irish Poetry - Karen O'Connor
Get your Irish Poetry Published
Garten und Landschaftsbau
 
gmail, why don't you change your script to not delete the printers and also change it to see if a printer exists and if so don't remap it?

Vbscript is such a powerful and flexible tool and it seems you have locked yourself into using a script you don't like. Why?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
it seems you have locked yourself into using a script you don't like. Why?
I didn't write the script, it already existed when I started in the company. But the person that did create it still works there, so I'm gradually trying to make changes to it. But I like your idea - thanks for that, might have to try that next week :)

Thanks again

Irish Poetry - Karen O'Connor
Get your Irish Poetry Published
Garten und Landschaftsbau
 
Just a quick note, you can also use the method decribed here.


this works very well for us, and seems to be easily managed.. I have had a brain fry today from studying so I am sorry if its not completely what your looking for but it doesnt require you to script jack diddly. :) Have a good day.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top