Solved

How to map a print queue inside command prompt?

Posted on 2002-05-15
9
534 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:keywaitao
ID: 7072474
Is this the command "capture" just exists in Win XP?
0
 
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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 demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

773 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