Solved

Remove or change shared TCP/IP printer on W2k server

Posted on 2006-06-28
4
236 Views
Last Modified: 2012-08-14
I have a printer shared and listed in Active Directory on my Windows 2000 server.  I need to change the printer name and / or share name but would like to have the clients currently connected to the printer automatically update to the new printer info and keep their connection.

My experience in the past is that this kind of change will cause the clients to retain a listing of the printer with its old info and show it as "unavailable" or "unable to connect".  Also, some clients will have the new printer automatically added, while others will not.  There are no group policy settings that I have set that should be creating these differences.
0
Comment
Question by:jbeach3
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:prashsax
ID: 17001801
Yes, if you change the share name of the printer, the old connection on client machines will not work.

You can use a logon script to install the new printer on client machine.

----------------------------------------------------------------------------------------------
Option Explicit
Dim objNetwork, strUNCPrinter
strUNCPrinter = "\\SERVER_NAME\PRINTER_NAME"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter

' Here is where we set the default printer to strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter
WScript.Echo "Check the Printers folder for : " & strUNCPrinter

WScript.Quit
-----------------------------------------------------------------------------------------------

Just copy and paste it into a file and name it "printlogon.vbs".
Change SERVER_NAME with the name of server where printer is shared.
Change PRINTER_NAME with the shared printer name.

Then use a group policy to run this script at user logon.

All, users will install the new printer and set to default automatically when they login.


0
 

Author Comment

by:jbeach3
ID: 17001887
What about the old printer?  Is there a way to remove it from all clients other than manually visiting each workstation?

My experience is that publishing a printer through AD is an easier way to propogate it to all clients.  Is the above code mainly to make the new printer the default printer?
0
 
LVL 13

Accepted Solution

by:
prashsax earned 500 total points
ID: 17001941
Ok here is the new script.

First test this on a PC by running it manually.

--------------------------------------------------------------------------------
'''''''''''''''''''''''''''''This section adds new Printer
Option Explicit
Dim objNetwork, strUNCPrinter
strUNCPrinter = "\\SERVER_NAME\PRINTER_NAME"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter

'''''''''''''''''''''''''''' Here is where we set the default printer to strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter

'''''''''''''This section deletes old Printer
Dim RobjNetwork, RstrUNCPrinter, RbForce, RbUpdateProfile
RstrUNCPrinter = "\\OLD_SERVER_NAME\OLD_PRINTER_NAME"
RbForce = "True"
RbUpdateProfile = "False"
Set RobjNetwork = CreateObject("WScript.Network")
''''''''''''''' Section which removes the network printer
RobjNetwork.RemovePrinterConnection strUNCPrinter, bForce, bUpdateProfile
Wscript.Quit
----------------------------------------------------------------------------------------------

0
 

Author Comment

by:jbeach3
ID: 17003537
Your script seems like it will progromatically do what I'm looking to accomplish.  I was hoping that there was something within the Active Directory functionality which would automatically purge printers once they had been removed from the AD printqueue list.  It would seem that's not possible, though.  Thanks for your help...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you might need to configure routing based not only on destination IP address, but also on a combination of destination IP address (or hostname) and destination port number. I will describe a method how to accomplish this with free tools. …
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

749 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