• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

Need a login script that will delete certain print queues

Hi Experts!  Here is the situation.  I have a client that has 15 users.  10 out of the 15 use different computers and when they do, they need printers mapped.  I figured no big deal when I signed up to support them but after doing the initial audit, they have printers shared on a few desktops, some shared on the server and a couple others that are local.  A huge mess since no one knows where they are printing when they sit at a different desk.  

I installed USB/NIC adapters and moved the printers that were being shared on the desktops to now be shared on the server.  I changed the other printers that were already on the server so that the naming scheme was consistent.  Here is my problem:

Some of the user profiles on several computers have printers listed that used to be shared by a desktop.  Since that setup doesn't exist, they are getting confused when the login script runs and they see two sets of printers.  I need to add to my login script a way to delete certain printer mappings that may already exist.  I can add the queue name but I don't know what the command is.

You are my only hope.....  : )   Thanks for any assistance you can offer up.  By the way, I know almost nothing on vbscript so if you offer something up that uses that, please be detailed.  
0
samiam41
Asked:
samiam41
  • 8
  • 7
1 Solution
 
virtuatechCommented:
0
 
KenneniahCommented:
Call prnmngr.vbs from your script.
cscript.exe prnmngr.vbs -d Printername

http://technet2.microsoft.com/windowsserver/en/library/1b6a1588-17f3-48a0-80e9-f52fb65ba21d1033.mspx?mfr=true
0
 
samiam41Author Commented:
Sorry gents.  Vacation and traveling took its toll on my time.  I apologize for not getting back to this sooner.

Virtuatech > Thanks for the post.  I see that the question was abandonded and the answer was forced.  Have you tried the solution given?  I don't want to wipe out all queue's, just certain ones.  Not sure how to modify the script to exclude the queue's I want to keep.  Any idea?

Kenneniah > Thanks for the post.  I reviewed that technet article before but didn't have any idea how to put together the commands.  I don't work with scripting enough to be able to do that.  If you can put something together, I would gladly test it.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
samiam41Author Commented:
Any new suggestions?
0
 
KenneniahCommented:
You don't have to do any scripting. Just use the command line.

cscript.exe prnmngr.vbs -d Printername

Printername is the printer you want to delete, not much to it. So if a printer you wanted deleted was "HP Deskjet" you'd run...

cscript.exe prnmngr.vbs -d "HP Deskjet"
0
 
samiam41Author Commented:
Oh....  I get it now.  Do the clients need to have that program on their computer to run?  If so, where should I put it.  Thanks for the help.
0
 
KenneniahCommented:
Nope, they are included with XP Professional. Sometimes you might need the full path however, so just to make sure I'd probably make it....
cscript.exe %systemroot%\system32\prnmngr.vbs -d Printername
0
 
samiam41Author Commented:
Outstanding!  That is perfect!  Thanks for the help.
0
 
KenneniahCommented:
Opps, I forgot the -p    :)
cscript.exe %systemroot%\system32\prnmngr.vbs -d -p Printername

Another option if you want to start from scratch at each login is a simple....
cscript.exe %systemroot%\system32\prnmngr.vbs -x
That will delete all printers, so only those you reconnect later in the logon script will exist.
0
 
samiam41Author Commented:
Even better!!  Man I am glad to have a solution for this.  I will test it out this weekend and post back any problems with it.  Thanks again for all of your help and patience!
0
 
samiam41Author Commented:
Thanks again!  I'm pretty confident this will work so I am going to accept the solution now and just post back any questions should any come up in the testing this weekend.  Great work!  Take care!

Regards,
Aaron
0
 
KenneniahCommented:
No problem :)
The way I would probably do it is to use the wipe clean method, then add the printers I want them to have in the logon script as well. It would look something like ....

cscript.exe %systemroot%\system32\prnmngr.vbs -x
cscript.exe %systemroot%\system32\prnmngr.vbs -ac -p "\\server\printshare1"
cscript.exe %systemroot%\system32\prnmngr.vbs -ac -p "\\server\printshare2"
etc.
etc.
0
 
samiam41Author Commented:
They have a PDF creator listed as a printer.  How should that be handled?  I thought about just listing the printers to be deleted rather than trying to add that printer back.
0
 
KenneniahCommented:
Hmm, yeah it can be a pain to correctly add some PDF printers through a logon script. In the long run it'll depend on how many printers you actually have to delete. If not too many, it won't take that long to make a line in the logon script for each that you want to remove.
0
 
samiam41Author Commented:
Cool.  That was what I was thinking.  Just mark out the 4 or 5 printers that I want deleted and then add the correct ones in.  I will leave that PDF printer alone.  I have another client with a similar issue but doesn't have any of the PDF printers that this client does.  You can bet that I will be adding your scripting to their login script.  Wahoo!  Thanks again for all of your help.  If I have any follow up questions, I will let you know.  Take care!
0
 
KenneniahCommented:
Sure thing, I'll be around so if you have any questions I'll try to get back ASAP :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now