Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripting an IP printer install 1

Status
Not open for further replies.

MrChopper

Programmer
Aug 11, 2004
20
US
I know how to script a printer install using an UNC, but I'm trying to write a script to install printers that use strictly IP printing. I'm really lost on this, any help would be appreciated
 
If they are HP printers they have a new product that is basically installing it from the command line. You configure a package like an msi file with all the IP details etc and just call the actual UNC path and setup.exe from the logon script.

Obviously this only works if you have HP printers that work with this program I think its the HP 1200n and 1300n.

This probably wont help but msi files are pretty good if its got a customisation utility supported.

Just put the package on a network share and run the exe.

Hope this helps a little at least. First time helping or trying to at least.

Cheers
 
Ok, thanks. However, I'd like to be able to run this from a vbsript too, as it will be part of a major configuration "package".
 
I think you can run it from vb script script using shell.run this run command line and also I believe you can run this executable from within vb.

The syntax is something like from shell:
shell.run "\\Application Path\setup.exe /qb+ /i",2,True

And similarly msiexec /i "\\Application Path\setup.exe"

Loads of other switches etc...Look on the microsoft site for Windows Installer Command Line Options

Again hope this helps.

Cheers John
 
I'm sorry, I'm probably not explaining myself clearly. I've seen vbscripts on the web that will install printers with a UNC path onto windows automatically, within the script. They didn't use any exe files or anything that might have come with a downloaded set of drivers, it was all done within the script itself. I would like to be able to do the same thing, except instead of UNC printers, I have printers that use direct IP's ONLY. Sorry if I didn't expalain myself throroughly.
 
Hello,
Here is what I have. You have to do some editing but it should work for you. It will create an IP port and install a printer on the port it created.

You have to edit the following sections to meet your needs: objPrinter.Location createPort addPrinter msgbox

Under the add printer section the printer you are installing must be typed exactly the way it appears in the add printer wizard



Copy and paste below. And save as a .vbs Good luck



''----------------------------------------------''

''----------------------------------------------''

'' ''

'' Script to automate TCP/IP printer installs ''

'' ''

''----------------------------------------------''

''----------------------------------------------''





Set WSHNetwork = WScript.CreateObject("WScript.Network")

set shell = WScript.CreateObject( "WScript.Shell" )

CompName = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")

Set objWMIService = GetObject("winmgmts:\\" & CompName & "\root\cimv2")

Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_

Set oShell = WScript.CreateObject("WScript.shell")

Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_



sub createPort (name, ip)

objNewPort.Name = name

objNewPort.Protocol = 1

objNewPort.HostAddress = ip

objNewPort.SNMPEnabled = False

objNewPort.Put_

end sub



sub addPrinter (driver, port, name)

objPrinter.DriverName = driver

objPrinter.PortName = port

objPrinter.DeviceID = name

objPrinter.Location = "EHN RM219"

objPrinter.Network = True

objPrinter.Shared = false

objPrinter.ShareName = ""

objPrinter.Put_

end sub





'------------------'

'Add printer ports:'

'------------------'

createPort "RM 206 HP4050", "10.17.106.150"



'----------------------------------------------'

'Install printers with drivers native to WinXP:'

'----------------------------------------------'



' TCP/IP Port Name Display Name

' -------------------- -----------------

addPrinter "HP LaserJet 4100 Series PS", "RM 206 HP4100", "RM 206 HP4100"



msgbox ("Printer installation complete. Don't Forget to make it the default printer")



 
Question #1: Do the computers already have the needed drivers for the printer installed?

I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top