Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Remove or change shared TCP/IP printer on W2k server

Posted on 2006-06-28
4
235 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

A common practice in small networks is making file sharing easy which works extremely well when intra-network security is not an issue. In essence, everyone, that is "Everyone", is given access to all of the shared files - often the entire C: drive …
I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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…

839 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