Solved

Need a login script that will delete certain print queues

Posted on 2008-06-20
16
301 Views
Last Modified: 2013-12-15
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
Comment
Question by:samiam41
  • 8
  • 7
16 Comments
 
LVL 5

Expert Comment

by:virtuatech
Comment Utility
0
 
LVL 24

Expert Comment

by:Kenneniah
Comment Utility
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
 
LVL 9

Author Comment

by:samiam41
Comment Utility
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
 
LVL 9

Author Comment

by:samiam41
Comment Utility
Any new suggestions?
0
 
LVL 24

Expert Comment

by:Kenneniah
Comment Utility
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
 
LVL 9

Author Comment

by:samiam41
Comment Utility
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
 
LVL 24

Expert Comment

by:Kenneniah
Comment Utility
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
 
LVL 9

Author Comment

by:samiam41
Comment Utility
Outstanding!  That is perfect!  Thanks for the help.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 24

Accepted Solution

by:
Kenneniah earned 500 total points
Comment Utility
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
 
LVL 9

Author Comment

by:samiam41
Comment Utility
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
 
LVL 9

Author Closing Comment

by:samiam41
Comment Utility
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
 
LVL 24

Expert Comment

by:Kenneniah
Comment Utility
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
 
LVL 9

Author Comment

by:samiam41
Comment Utility
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
 
LVL 24

Expert Comment

by:Kenneniah
Comment Utility
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
 
LVL 9

Author Comment

by:samiam41
Comment Utility
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
 
LVL 24

Expert Comment

by:Kenneniah
Comment Utility
Sure thing, I'll be around so if you have any questions I'll try to get back ASAP :)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

cPanel is a Unix based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilizes a 3 tier structure that provides functionality for administrators, rese…
Step by step guide to Clean and Sort your windows registry! Introduction: Always remember: A Clean registry = Better performance = Save your invaluable time In this article we're going to clear our registry manually! Yes, manually! The e…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

10 Experts available now in Live!

Get 1:1 Help Now