Solved

Setting up printer via scripts

Posted on 2007-03-22
9
169 Views
Last Modified: 2010-08-05
Great Day EXPERTS!
I have been tasked with the job of moving 50 people this weekend in into new office. A great portion of people will be receiving new machine. Therefore, I will have to setup all there printer again. I now you are wondering why aren’t we using roaming profile, it was not my decision but my boss and other coworkers. So I was wondering is there a script out on the web that I can uses that will allow me to place on the desktop and all they would have to do is select the icon script and it will load all the printer on the network or just this location or can one be written for me.

0
Comment
Question by:melvinsanders
  • 4
  • 4
9 Comments
 
LVL 21

Expert Comment

by:mastoo
ID: 18773407
You can make a batch file that holds commands like this to add network printers:

prnmngr -ac -p "\\server\printer"
0
 

Author Comment

by:melvinsanders
ID: 18773720
I am not sure how to write a batch file that would allow me to do so.
0
 
LVL 21

Expert Comment

by:mastoo
ID: 18774050
Use wordpad to create a text file called MyPrnt.cmd
Edit it to contain this line but fill in the name of the server and printer you want to add:

prnmngr -ac -p "\\server\printer"

Close wordpad.  To test it, open a command prompt, go to the directory you put MyPrnt.cmd in, type MyPrnt.cmd to run it, see what happens.  If that works, then it should work if you copy the file to somebody's desktop and they double-click it from there.
0
 

Author Comment

by:melvinsanders
ID: 18774185
I am sorry I went to the cmd prompt and nothing happened. I copied the info to word pad ran it and something flashed for a sec. I check the printer and faxes to see if it added the printer i sorry and it did not.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:melvinsanders
ID: 18774401
Can you try this, I am running 2003 server my dcsvr name is be dcsvr1 printer name HQ-CanonIR8500. I I have tried the batch file you sent it did not work for me or i just did not do it right therefore can you type it up.


@ECHO OFF
VER | FIND "Windows 2000" >NUL
IF ERRORLEVEL 1 GOTO Syntax

SETLOCAL
SET Printer=%1
SET RemotePC=%2

:: Check printer specified
IF NOT DEFINED Printer GOTO Syntax
IF NOT "%Printer:~0,2%"=="\\" GOTO Syntax
FOR /F "tokens=1* delims=\" %%A IN ('ECHO.%Printer%') DO (
      SET PrintServer=%%A
      Set PrintShare=%%B
)
IF NOT DEFINED PrintShare GOTO Syntax
PING %PrintServer% -n 1 -w 1000 2>&1 | FIND "TTL=" >NUL
IF ERRORLEVEL 1 GOTO Syntax
NET VIEW \\%PrintServer% 2>&1 | FIND /I "%PrintShare%" >NUL
IF ERRORLEVEL 1 GOTO Syntax

:: Check remote PC if specified
IF DEFINED RemotePC SET RemotePC=%RemotePC:\=%
IF DEFINED RemotePC (
      PING %RemotePC% -n 1 -w 1000 2>&1 | FIND "TTL=" >NUL
      IF ERRORLEVEL 1 GOTO Syntax
      SET RemotePC=/C\\%RemotePC%
)

:: Install the printer on the specified computer
RUNDLL32.EXE PRINTUI.DLL, PrintUIEntry /ga /n%Printer% %RemotePC%
IF NOT ERRORLEVEL 1 ECHO Printer installed, please reboot %RemotePC%

ENDLOCAL
GOTO:EOF

:Syntax
ECHO.
ECHO AddPrint.bat,  Version 1.01 for Windows 2000
ECHO Install a network printer on any PC on the network
ECHO.
ECHO Usage:  ADDPRINT  \\print_server\printer_share  [ remote_pc ]
ECHO.
ECHO Where:              "print_server"   is the print server name or IP address
ECHO                     "printer_share"  is the share name for the printer
ECHO                     "remote_pc"      is the PC that will be using the
ECHO                                      network printer -- default is local PC
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com

IF "%OS%"=="Windows_NT" ENDLOCAL

0
 
LVL 21

Expert Comment

by:mastoo
ID: 18774895
I like the AddPrint.bat file you posted a lot better than my one liner.  Doesn't it work?  What error do you get?
0
 

Author Comment

by:melvinsanders
ID: 18774934
Windows cannot access the specified  device, path, or file. you may not have the appropriate permissions to accesst the item. Try it
0
 
LVL 21

Accepted Solution

by:
mastoo earned 500 total points
ID: 18775216
How about delete the first line that turns the echo off.  Then when you run the script it will show each line as it executes, so you'll be able to see which line is giving the error.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

743 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

13 Experts available now in Live!

Get 1:1 Help Now