Solved

Remove or change shared TCP/IP printer on W2k server

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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