Deploying Microsoft IPP Printing

Posted on 2007-10-03
Last Modified: 2008-05-31
Alright experts I need some advice and possibly some scripting help.  I currently have around 200 machines using Novell NDS printing.  We are in the process of migrating to the Microsoft IPP solution but I need help with the deployment and I really don't want to do this manually.  We have a print server with Windows Server 2003 R2, and all the clients are XP.  I've read that you can deploy the printers through group policy, however the with the way the OU's are setup this is an impracticle solution.  I need to be able to deploy the printers dependant on location or a group.  So here's the question, does anybody know a way to:
First: Delete the existing NDS printers from the machine.
Second: Deploy the new Microsoft IPP printers dependant on group or location
Third: Once the printer is deployed set the default for each particular group.

I figure a script could probably do all of this, but I am very inexperienced in scripting.
Question by:kjmeldrum
    LVL 8

    Expert Comment

    When you say group, do you mean OU in active directory, security group, or something else?  As for location, I assume you mean physical location of the PC - this isn't really useful from a scripting point of view.  I should be able to provide you with a script once you let me know what you mean by group.
    LVL 1

    Author Comment

    I'm refering to a security group.  Due to the OU structure we have it would be impossible to split up via OU so I'm forced to use security groups instead.
    LVL 8

    Expert Comment

    OK, I'll try and get you a sample tonight or early tomorrow - I have a script I typically use on my home machine and need to grab it for you.
    LVL 8

    Accepted Solution

    Give the following a shot, it may need some testing in your environment, and make sure you change group names, printer/server names, etc in the appropritate locations.  This will check the AD security group membership of a user (typically during logon) and if they're in the group listed run the commands under it (to add/delete printers).  It will also set the default printer to whichever you specify, feel free to edit as necessary.  I also gave you a section on mapping a home drive (or any other file share using group membership as well) don't know if that's helpful or not.  Let me know if you get any errors, make sure you test it before deploying.  Everything below here is part of the script, put it in a text file, edit it, then change the extension to .vbs and give it a whirl.

    Option Explicit

    ' Created by: JjcampNR                                                    *
    ' Copyright Notice: None - enjoy freely.                                  *
    ' Last Modified: 10/09/2007                                              *
    ' Abstract: Remove old printers and add new based on AD security group memebership  *

    ' Set error handling
    On Error Resume Next

    ' Declarations
    Const OverwriteExisting = True
    Dim objNetwork, objFSO, strGroupName, strDomain, strUser, bolIsMember
    Dim objUser, objGroup, objFileOnServer, objFileOnClient

    Set objNetwork = WScript.CreateObject("WScript.Network")
    Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
    Set WshNetwork = WScript.CreateObject("WScript.Network")

    ' Find domain membership function
    Function IsMemberOf(strGroupName)
      Set objNetwork = Wscript.CreateObject("WScript.Network")
      strDomain = objNetwork.UserDomain
      strUser = objNetwork.UserName
      bolIsMember = False
      Set objUser = GetObject("WinNT://" & strDomain & "/" & _
        strUser & ",user")
      For Each objGroup In objUser.Groups
        If objGroup.Name = strGroupName Then
          bolIsMember = True
          Exit For
        End If
      IsMemberOf = bolIsMember
    End Function

    ' Network drive mappings

    ' Delete and map drive H:
    obj.Network.RemoveNetworkDrive "H:", , True
    obj.Network.MapNetworkDrive "H:", "\\Server\Homes\user", true

    ' End of network drive mappings
    ' MsgBox "End of drive mappings."

    If IsMemberOf("_SecurityGroup") Then

      'Remove Printers
      objNetwork.RemovePrinterConnection "\\Server\OldPrinter"

      ' Add Printers
      WshNetwork.AddWindowsPrinterConnection "\\Server\NewPrinter

      'Set Default Printer
      WshNetwork.SetDefaultPrinter "\\Server\Printer1"

    End If


    If IsMemberOf("_SecurityGroup2") Then

      'Remove Printers
      objNetwork.RemovePrinterConnection "\\Server\OldPrinter"

      ' Add Printers
      WshNetwork.AddWindowsPrinterConnection "\\Server\NewPrinter

      'Set Default Printer
      WshNetwork.SetDefaultPrinter "\\Server\Printer1"
    End If

    ' MsgBox "End of script."
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Learn about cloud computing and its benefits for small business owners.
    Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
    This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
    This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now