Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

batch file to add printers to windows 2000 server


  • Please log in to reply

#16
thebucs

thebucs

    Member

  • Topic Starter
  • Member
  • PipPip
  • 51 posts
it is not there, also the directory for system32 on this 2000 server is C:\WINNT\system32

there is a print.exe, printmon.inf and printui.dll

search all computer for prnport

could not be found.

whnen do cscript at cmd promt i ge the following

microsoft ® windows script hosy version 5.6
copyright............

usage: cscript scriptname.extension [option...] [argumnts...]

options:
//b batch mode: suppresses script errors and prompts from diplaying
//d enable active debugging
//e:engine use engine for executing script
//h:cscript changes the default script host to cscript.exe
//h:wscript changes the default script host to wscript.exe
//i interactive mode
//job:xxxx execute a wsf job
//logo display logo
//nologo prevent logo
//s save current command line options for this user
//t:nn time out in seconds
//x execute script debugger
//u use unicode for redirect i'o from the consol
  • 0

Advertisements


#17
gerryf

gerryf

    Retired Staff

  • Retired Staff
  • 11,365 posts
OK...that is odd. It should be there...at least, I am pretty sure it should be there....I don't have a win2k server around.

BUt you do have the cscript loading....that's good.

I'vbe got a busy day ahead....let's see if the previous suggestion from Dsennette might work, so I will have to do some reading, but I will not be able to get back to it until at least tonight
  • 0

#18
thebucs

thebucs

    Member

  • Topic Starter
  • Member
  • PipPip
  • 51 posts
ok is good. i am on show site, and will be closing the show in about 3 hours, so after that, it may be monday before i am able to get back on.
thanks for all you help thus far and thanks in advance for help to come on this topic
thanks
brian
  • 0

#19
gerryf

gerryf

    Retired Staff

  • Retired Staff
  • 11,365 posts
diud a quick check, and those scripts are not included with win2k (dang)--furthermore, tehy will work with win2k or I'd just send them...

Need to do a custom script for win2k, but I will need to do some reading....I can write a script to add 1 printer fairly quickly, but not 100.... need to think about that for a while....
  • 0

#20
thebucs

thebucs

    Member

  • Topic Starter
  • Member
  • PipPip
  • 51 posts
if you can write script to add one, i will duplicate it and change what is needed to add the rest of the printers, even if it means multiple scripts
  • 0

#21
thebucs

thebucs

    Member

  • Topic Starter
  • Member
  • PipPip
  • 51 posts
ok, i am back, sorry about the delay. was travelling back home. any luck so far with this?
  • 0

#22
gerryf

gerryf

    Retired Staff

  • Retired Staff
  • 11,365 posts
actually yes...while trying to figure out how to script these, I stumbled across some ready made scripts here:

http://www.microsoft...ts/default.mspx

These are single printer scripts, but you could individualize them and script them to all run in a batch file like this


install_printer.bat
-------------------------
wscript printerport1.vbs
wscript printer1.vbs
wscript printer2.vbs
etc....
  • 0

#23
gerryf

gerryf

    Retired Staff

  • Retired Staff
  • 11,365 posts
Ahh crap, just noticed that will not work for 2000

dang, ok, another alternative

http://www.microsoft...&DisplayLang=en

This is the Windows Resource Kit for Server 2003

I am told it will work for Windows 2000 as well

Inside the download, you will find Prnadmin.dll

After install, in the C:\Program Files\Windows Resource Kits\Tools folder, you will find

A word Document called "Using Prnadmin.dll to Manage Printer Objects"

This explains how to do what you are after....It's a little vague, but under adding a printer and adding a printer connection are directions on how to do this...just add the code and cut the explanation
  • 0

#24
thebucs

thebucs

    Member

  • Topic Starter
  • Member
  • PipPip
  • 51 posts
only one problem, the script for adding printer port and drivers are for xp or 2003 server. do you know of any for 2000 server?
  • 0

#25
thebucs

thebucs

    Member

  • Topic Starter
  • Member
  • PipPip
  • 51 posts
oops i was a bit late on my reply. i got caught up in antoher issue. thanks for the update. i will let you know how it turns out. any more suggestions would be greatly appreciated.
thanks
  • 0

Advertisements


#26
thebucs

thebucs

    Member

  • Topic Starter
  • Member
  • PipPip
  • 51 posts
well i did the download, but it wont install requires xp or newer to install. :-(
  • 0

#27
thebucs

thebucs

    Member

  • Topic Starter
  • Member
  • PipPip
  • 51 posts
gerryf,
do you have prnport.vbs and prnmgr.vbs on your computer?
it seems as though that is what i need. i cant seem to find it for 2000 server, or maybe im looking in the worng place. i may have figured the script, but withouy these files, it wont run. the following is what i changed the script to
cscript.exe prnport.vbs -a -r E211 -h 10.0.6.211 -o raw

cscript.exe prnmgr.vbs -a -p "E211" -m "HP LaserJet 4" -r E211

on both of them, the script started to run, then failed because the prnport.vbs and prnmgr.vbs do not exist.
  • 0

#28
gerryf

gerryf

    Retired Staff

  • Retired Staff
  • 11,365 posts
this is turning out to be a darn bit harder than I expected...still looking

If the printers were hooked to a print server, this would not be such a big deal, but since they are network printers, the issue is more complex

hmmmm, thinking
  • 0

#29
gerryf

gerryf

    Retired Staff

  • Retired Staff
  • 11,365 posts
Found this example, but I have no way to test it





--> Raw Port 9100, no SNMP

Set objWMIService = GetObject("winmgmts:")
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_192.168.40.20"
objNewPort.Protocol = 1
objNewPort.HostAddress = "192.168.40.20"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_


--> LPR Port, SNMP

Set objWMIService2 = GetObject("winmgmts:")
Set objNewPort2 = objWMIService2.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort2.Name = "IP_192.168.40.21"
objNewPort2.Protocol = 2
objNewPort2.HostAddress = "192.168.40.21"
objNewPort2.Queue = "MyQueue"
objNewPort2.ByteCount = True
objNewPort2.SNMPEnabled = True
objNewPort2.SNMPDevIndex = 2
objNewPort2.SNMPCommunity = "MySNMP"
objNewPort2.Put_


Save as <filename>.vbs and start using cscript.exe or wscript.exe
This will create the ports for you.



Then, you use the second script to add it



rundll32 printui.dll,PrintUIEntry /if /b "NORTH-US-SRTEST-TEST24-BOGUS" /f %windir%\inf\ntprint.inf /r "IP_192.168.40.20" /m "HP Laserjet 4000 Series PCL" /Z




naturally, you substute your info

IP_192.168.40.20=port name
"NORTH-US-SRTEST-TEST24-BOGUS"= location

"HP Laserjet 4000 Series PCL" = name
  • 0

#30
thebucs

thebucs

    Member

  • Topic Starter
  • Member
  • PipPip
  • 51 posts
i have also come up with something.
i have copied prnport.vbs to the root of c:
i wrote a script(but it also works from cmd promt) and i get an error here is the script

cscript.exe prnport.vbs -a -r E211 -h 10.0.6.211 -o raw -n E211

the error it gives me is
unable to get port error 0x80041002 not found

i will test what you have given me and let you knkow.
thanks

in the meantime, have you seen this error, or know how to correct it?
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP