Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 430
  • Last Modified:

Add / remove printers on existing SBS 2003 R2 network - this is probaby real basic but I need help!

My SBS networks are very steady state.  But I have 1 where the 2 original network printers are 1 - being removed and another is being moved to a desktop.

ANd a new network printer is coming in.

without going to every desktop (we have local profiles, not roaming), how do I:

remove the 2 old printers from each person's list of printers
Add this new printer to each person's list of printers (I know how to add it to the server and share it, but then how does that show up on each machine.  I know when setting up SBS with the wizards, you set up the printer first and then the users get the printers that exist at that point.  but going forward how do you add / remove printers to each user's profile)?

ANd the 1 printer that is being connected to a desktop and shared to a couple pcs in that room.  How do we keep xp from automatically adding that printer to everyone's profile because it's a shared printer on the same subnet - you know - you get that 'auto HP laserjet....' icon that was created automatically by the xp desktop.

THANK YOU!
0
babaganoosh
Asked:
babaganoosh
  • 5
  • 4
1 Solution
 
EddyGurgeCommented:
While I am no real expert on this topic, I did just do almost this exact same thing last week.  In this case it was the removal and replacement of a shared network printer. The following vbs script is what I used to remove the old one, and add the new one.  I added this to the login group policy of the OU

Set objWSHNetwork = CreateObject("WScript.Network")  'create network object
strConnectString = "\\server1\NewPrinterShareName"
strResult = objWSHNetwork.AddWindowsPrinterConnection(strConnectString)
strConnectString = "\\server1\OldPrinterShareName"
On Error Resume Next
strResult = objWSHNetwork.RemoveWindowsPrinterConnection(strConnectString)
0
 
EddyGurgeCommented:
Oh, and I should mention the script actually adds the new one, THEN deletes the old one.  Not sure if that was clear or not from the script.
0
 
babaganooshAuthor Commented:
thanks for the info.  I came across this - I don't know the first thing about vb script.  this also sets the default printer.

yours, every time you log in, (tries to) delete the old printer?  That's OK?

how does yours with the strconnectstring differ from this net.....

Dim net
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\spock\LJ4014n"


' Set the default printer now
' net.SetDefaultPrinter "\\spock\lj4014n"

and I guess i'd add
net.RemoveWindowsPrinterConnection "\\spock\lj4050"
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
babaganooshAuthor Commented:
ok, on an xp box, I got an error about the last line - remove

And the default pritner comment is remmed out, right?  I think that was because some people didn't want the 4050 as their default.

I'll use your script I guess : ) ?
0
 
babaganooshAuthor Commented:
but again - what is the difference in your script and mine (mine being the net. command at the start... and your delete command works)
0
 
EddyGurgeCommented:
I'm not a script expert at all, but I do notice that in the one I use, the printer name is put into a variable, then used in the command.  On the description pages for these commands from Microsoft, it also uses a variable, instead of a string when connecting and disconnecting.  Check here:

http://msdn.microsoft.com/en-us/library/tsbh2yy7(VS.85).aspx

As far as it trying to remove the printer every time, I've had no issues at all.  I didn't see an IfExist type method to add, but it seems to work perfectly now.  I figure after a few months, I'll just rem the script out anyway.


0
 
babaganooshAuthor Commented:
Thanks for the info.  


I may have missed something - you said 'I added this to the login group policy of the OU'

I set this up as a file called printer.vbs and then called it from the logon batch file.  are you doing something different?

And I had to remove 'windows'  from your
net.RemoveWindowsPrinterConnection

command.  which is how it shows in that link you included!  

Yeah, I don't know the first thing about scripts myself.  just enough to take code someone else used, and maybe change some fields to do what I want it to do!

amazing, I think - they have all these wizards in sbs but nothing for something like this - adding a printer once the network is up and running and deleting old printers.

thanks!
0
 
EddyGurgeCommented:
I'm not fully up on the variances between SBS and regular 2003 server, but it sounds like basically the same thing.  Since I didn't already have any kind of login batch file, I just added the printer script.  As long as you can get it running, that's all that really matters.
0
 
babaganooshAuthor Commented:
true!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now