Solved

Need a login script that will delete certain print queues

Posted on 2008-06-20
16
304 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
ID: 21833536
0
 
LVL 24

Expert Comment

by:Kenneniah
ID: 21833538
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
ID: 21945270
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
ID: 22003136
Any new suggestions?
0
 
LVL 24

Expert Comment

by:Kenneniah
ID: 22025176
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
ID: 22025206
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
ID: 22025248
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
ID: 22025275
Outstanding!  That is perfect!  Thanks for the help.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 24

Accepted Solution

by:
Kenneniah earned 500 total points
ID: 22025277
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
ID: 22025320
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
ID: 31469263
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
ID: 22025488
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
ID: 22025511
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
ID: 22025889
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
ID: 22025912
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
ID: 22025989
Sure thing, I'll be around so if you have any questions I'll try to get back ASAP :)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

22 Experts available now in Live!

Get 1:1 Help Now