Solved

How to map a print queue inside command prompt?

Posted on 2002-05-15
9
532 Views
Last Modified: 2008-02-01
Is it possible to map a print queue via the command prompt?
0
Comment
Question by:keywaitao
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 1

Expert Comment

by:Old_Dog
ID: 7016146
Others may do different, but I use a VB script to map printers correctly regardless of where a User might log in.

Save the list below into a text document and rename it with a .vbs suffix.  You can then either
a) Run the script manually by double-clicking on it
b) Use it as a logon script.


' VB SCRIPT START

Dim myLan, sUser, sMachine, startTime
Dim myShell
Dim printer1, printer2, printer3

' List the print queues available on the server :

printer1   = "\\server\HP4100UP"     ' A printer upstairs
printer2   = "\\server\HP4100DOWN"   ' A printer downstairs
printer3   = "\\PC15\HP990CUP"       ' Another upstairs

Set myLan = CreateObject("WScript.Network")
Set myShell = CreateObject("WScript.Shell")

'Looping this section to wait for PC name and username :
sUser = myLan.UserName
sMachine = myLan.ComputerName
startTime = Now
Do While sUser = ""
   If DateDiff("s", startTime, Now) > 30 Then Wscript.Quit
   Wscript.Sleep 500
   sUser = myLan.UserName
   sMachine = myLan.ComputerName
Loop

' "PC1" is the machine name of a PC downstairs...
If (sMachine = "PC1") Then
   myLan.RemovePrinterConnection printer1, true, true
   myLan.RemovePrinterConnection printer2, true, true
   myLan.AddWindowsPrinterConnection printer3
   myLan.SetDefaultPrinter printer3
End If

' "PC26" is a machine upstairs...
If (sMachine = "PC26") Then
   myLan.RemovePrinterConnection printer3, true, true
   myLan.AddWindowsPrinterConnection printer1
   myLan.AddWindowsPrinterConnection printer2
   myLan.SetDefaultPrinter printer1
End If

' VB SCRIPT END
...etc etc

0
 

Author Comment

by:keywaitao
ID: 7043556
Is there any method to use other than VB script?
I am not familiar with it. Also, to run VBScript, it must have the help of Windows Script Host.
0
 
LVL 2

Accepted Solution

by:
gavrc earned 100 total points
ID: 7061674
There is a "capture" command in DOS which might help you. For example we use:
"capture lpt2 q=q127_jet nb na nff ti=15"
in a logon script for one of our users. q127 is the print queue in question.
0
 

Author Comment

by:keywaitao
ID: 7072474
Is this the command "capture" just exists in Win XP?
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 2

Expert Comment

by:gavrc
ID: 7074890
Capture isn't supported by NT4 and is used to grab printer queues on Netware servers. Queues on Windows servers can be captured using the "net use" command as described here...
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q154498
Any help?
(BTW I left out the # at the beginning of the login script line)
0
 
LVL 27

Expert Comment

by:Asta Cu
ID: 7135354
Have you been helped here or is more needed?  Since time has passed since your last comment, an update is appreciated (in case things have changed).  If you've been helped, convert the expert's comment to the Accepted Answer to grade and close it.  If more than one helped you, ask for a point split by posting a zero point question in the Community Support topic area, include this link and details with your request (expert name and point values to each).

This is the Community Support link:
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

Thanks,
":0)
Asta
0
 
LVL 27

Expert Comment

by:Asta Cu
ID: 7289078
Hopefully you've already been helped, and this question remains open today for your next action.  If you've been helped, please convert that expert's comment to the answer to grade and close this.  If more than one helped you resolve this, request a Point Split via a zero point question in the Community Support topic area with details and this question link (URL).  

This may interest you, if not already done, follows.

Windows XP Service Patch 1 (CRITICAL UPDATE) was available using WindowsUpdate recently (huge), more information and links about there here, if you're not already aware.

CD Options here:
http://www.microsoft.com/windowsxp/pro/downloads/servicepacks/sp1/ordercd.asp
Microsoft Windows XP Service Pack 1 Installation and Deployment Guide
http://www.microsoft.com/WindowsXP/pro/downloads/servicepacks/sp1/spdeploy.asp

Windows XP Service Pack 1 information
http://www.microsoft.com/WindowsXP/pro/downloads/servicepacks/sp1/default.asp
 
Internet Explorer 6 Service Patch 1 (CRITICAL UPDATE) was available from WindowsUpdate yesterday and highly recommended to fix significant problems.  You may wish to check WindowsUpdate directly.  Some more insights about these updates here:

http://www.microsoft.com/windows/ie/default.asp
http://www.microsoft.com/windows/ie/evaluation/ie6sp1.asp
The following link shows you the list of fixes included in IE 6 SP1
http://support.microsoft.com/common/canned.aspx?R=d&H=List%20of%20Fixes%20in%20Microsoft%20Internet%20Explorer%206%20SP1&LL=support&Sz=kbIE600sp1fix&Fr=&DU=&SD=GN&LN=EN-US&CND=1&VR=&CAT=&VRL=&SG=&MaxResults=150

If more is needed, please let us know.
Good luck,
":0) Asta
0
 

Expert Comment

by:slateblu
ID: 7796342
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Answered by: gavc
- Place in PAQ

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thank you,

SB
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7866106
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

If you build your web application in Visual Studio you'll get at least a few binaries, or .DLL, files in your bin folder. However, there is more compiling to be done. Normally this would happen when an ASP.NET resource within the web site is request…
Can you find a fax from a vendor you saved a decade ago in seconds? Have you ever cursed your PC under your breath during an audit because you couldn’t find the requested statement or driver history?  If you answered no to the first question or yes …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

706 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

17 Experts available now in Live!

Get 1:1 Help Now