Solved

Remove or change shared TCP/IP printer on W2k server

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Systems Enngineer 8 57
Sonicwall AP 3 48
How often can a passive RFID be polled? 10 47
HP Laser Jet Errors 10 56
FIPS stands for the Federal Information Processing Standardisation and FIPS 140-2 is a collection of standards that are generically associated with hardware and software cryptography. In most cases, people can refer to this as the method of encrypti…
The Need In an Active Directory enviroment, the PDC emulator provide time synchronization for the domain. This is important since Active Directory uses Kerberos for authentication.  By default, if the time difference between systems is off by more …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

16 Experts available now in Live!

Get 1:1 Help Now