Sponsored Content
Special Forums Windows & DOS: Issues & Discussions Finding printers from a command prompt Post 302069650 by jallport on Tuesday 28th of March 2006 07:24:25 AM
Old 03-28-2006
Very clunky, but:

for /f %i in ('net view') do net view %i | find "Print" >>result.txt

Explanation:
'net view' - command to display all sharing-enabled computers in a workgroup or domain.
'for /f %i ...' - for each line of result (%i) from 'net view', list the shares on that computer.
'| find "Print" - Pipe the preceding output through FIND.COM and look for the string "Print", indcating a shared printer.
'>>result.txt' - append the output to the file "result.txt", NOTE: >> to append, not > to write to or we'll only see the last positive match in our file.

The resulting file (result.txt in this case) will look something like:
[Netbios name, Service, Comment]

AC_PRN Print Accounts department multifunction

PR_DESJ Print Public Relations department Colour Deskjet

SH_DMP Print Shipping office dot-matrix label printer

Hope it helps.

If you want anything better I think you're going to have to look at some VB scripting and active directory-based looking-up.

Last edited by jallport; 03-28-2006 at 08:29 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command prompt from within a script?

I am writing a menu script and one of the options is to access a Command Prompt and return to the menu via CTRL-D. I have tried using a loop and echoing the PS1 value, then using read to assign whatever is entered into a variable, then executing the value of that variable as a command using .... (1 Reply)
Discussion started by: sanitywonko
1 Replies

2. Windows & DOS: Issues & Discussions

Display Printers via command line

Is there an easy way to view all printers on a local machine via command line or a script? I'm looking for the equivalent of clicking on "START, CONTROL PANEL, PRINTERS AND FAXES" to view the devices. I then want to cat it to a file where I would use it later. Thanks (3 Replies)
Discussion started by: gseyforth
3 Replies

3. SuSE

inconsistent ls command display at the command prompt & running as a cron job

Sir, I using the following commands in a file (part of a bigger script): #!/bin/bash cd /opt/oracle/bin ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out If I run this from the command prompt the result is: 2007-05-16 if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies

4. Windows & DOS: Issues & Discussions

Command Prompt

Hi does anyone know know how to find out the password on a vista pc using command prompt /cmd not change it (1 Reply)
Discussion started by: popo123456789
1 Replies

5. UNIX for Dummies Questions & Answers

What does $ represent in command prompt?

What does $ represent in command prompt? (2 Replies)
Discussion started by: ashok.g
2 Replies

6. UNIX for Advanced & Expert Users

autosys command(autorep) from command prompt

Hi, I am using AUTOSYS GUI based tool. But I want to get the job status from the UNIX command prompt. 1. I want to execute only autorep command in the UNIX command prompt. If need to execute this command what are the settings need to do that. 2. Is it possible for executing this... (5 Replies)
Discussion started by: onesuri
5 Replies

7. UNIX for Dummies Questions & Answers

Execution of command at command prompt

Hello Experts, I am still learning linux and have come across a question, hope to get some answer. I have two servers, and both have the same version of svn client installed and both have the same user_id. my SVN client version: svn, version 1.6.11 (r934486) compiled Mar 2 2011,... (4 Replies)
Discussion started by: babyPen1985
4 Replies

8. SCO

Booting to Command Prompt

Hello, I need help booting to a command prompt. The server runs SCO Openserver 5.0, with a point of sale program that automatically boots upon startup. I can't gain root access, and the administrator password for the point of sale program is un-obtainable. I am upgrading to a new point of sale... (8 Replies)
Discussion started by: tedcurvin
8 Replies

9. Shell Programming and Scripting

Command prompt

Hi All, Even changing .bash_profile, i am getting only $ as command prompt. My bash profile looks like this. PS1=" $ " stty columns 200 set -o vi if i run bash command and run PS1=" $ " then it is working as expected. $ bash (4 Replies)
Discussion started by: akshu.agni
4 Replies

10. UNIX for Dummies Questions & Answers

Shell script not working but command works in command prompt

Hi everyone I have a problem with my script If I try directly this command /usr/bin/nice -n 19 mysqldump -u root --password="******" wiki_schneider -c | nice -n 19 gzip -9 > /point_de_montage/$(date '+%Y%m%d')-wiki-db.sql.gz It works But if I simply add this command in a script and... (8 Replies)
Discussion started by: picemma
8 Replies
printmgr(1M)						  System Administration Commands					      printmgr(1M)

NAME
printmgr - Solaris Print Manager is a graphical user interface for managing printers in a network SYNOPSIS
/usr/sadm/admin/bin/printmgr DESCRIPTION
Solaris Print Manager is a Java-based graphical user interface that enables you to manage local and remote printer access. This tool can be used in the following name service environments: LDAP, NIS, NIS+, and files. You must be logged in as superuser to use this tool. Using Solaris Printer Manager is the preferred method for managing printer access because Solaris Print Manager centralizes printer infor- mation when it is used in a name service environment. Adding printer information to a name service makes access to printers available to all systems on the network and generally makes printer administration easier because all the information about printers is centralized. Solaris Print Manager may be run on a remote system with the display sent to the local system. See the System Administration Guide: Advanced Administration for instructions on setting the DISPLAY environment variable. Using Solaris Print Manager to perform printer-related tasks automatically updates the appropriate printer databases. Solaris Print Manager also includes a command-line console that displays the lp command line for the add, modify, and delete printer operations. Errors and warn- ings may also be displayed when Printer Manager operations are performed. Help is available by clicking the <Help> button. USAGE
Solaris Print Manager enables you to do the following tasks: Select a Name Service Select a name service for retrieving or changing printer information. Add Access to a Printer Add printer access on a printer client using Solaris Print Manager. Add an Attached Printer After physically attaching the printer to a system, use Solaris Print Manager to install a local printer and make it available for printing. Add a Network Printer After physically attaching the printer to a system, use Solaris Print Manager to install a local printer and make it available for printing. Modify Printer Properties After adding access to a printer or adding an attached or network printer, you can modify certain printer attributes. Delete a Printer Delete access to a printer from the print client or delete a printer from the print server or from the name service environment. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWppm | +-----------------------------+-----------------------------+ SEE ALSO
ldap(1), lpget(1M), lpset(1M), attributes(5) System Administration Guide: Advanced Administration for information on LDAP server replication. Although users can use the LDAP command line utilities ldapadd(1) and ldapmodify(1)to update printer entries in the directory, the pre- ferred method is to use lpset. Otherwise, if the lpadd and lpmodify utilities are used, the administrator must ensure that the printer-name attribute value is unique within the ou=printers container on the LDAP server. If the value is not unique, the result of modifications done using lpset or the Solaris Print Manager, printmgr(1M) may be unpredictable. SunOS 5.10 23 May 2003 printmgr(1M)
All times are GMT -4. The time now is 03:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy