Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Setting up printer via scripts

Posted on 2007-03-22
9
Medium Priority
?
189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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
 

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 2000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

604 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