Link to home
Start Free TrialLog in
Avatar of TGignac
TGignac

asked on

VBScript to add http printer

OK everyone... I'm stumped.

I need to be able to add an http printer to clients using a vbs login script.
I currently map all of my organizations printers using the WSHNetwork.AddWindowsPrinterConnection but for the life of me I cannot see where to add a printer that is a http printer.

I've tried WSHNetwork.AddWindowsPrinterConnection "\\http://<server>/<printer>" but it wont work.

Anyone have a solution or alternate way to achieve this goal?

Much appreciated.
Avatar of chandru_sol
chandru_sol
Flag of India image

You need not user http

Can you try the below simple script?

Option Explicit
Dim netPrinter, UNCpath
UNCpath = "\\YourServer\PrinterName"
Set netPrinter = CreateObject("WScript.Network")
netPrinter.AddWindowsPrinterConnection UNCpath
WScript.Echo "Your printer is mapped from : " & UNCpath
WScript.Quit
' End of example VBScript
What is the printer you are referring to as http printer?

I think you will be accessing the embeded webserver using the http://Ipaddress.

is it a network printer?
Avatar of TGignac
TGignac

ASKER

http Printer... a printer shared with a URL, not a UNC. When you add a printer using the print wizard in Windows XP, you have the ability to add a printer by URL. This is a IPP or sometimes referred to as an http printer.

It is not a network printer but a printer shared over the internet.
ASKER CERTIFIED SOLUTION
Avatar of chandru_sol
chandru_sol
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TGignac

ASKER

Thanks chandru sol

I ended up with using this command in my vbscript:

wshShell.Run "rundll32 printui.dll,PrintUIEntry /b ""<Printer Name>"" /x /n ""<Printer Name>"" /if /f %windir%\inf\ntprint.inf /r ""http://<URL/Printer>"" /m ""<Printer Driver Name>(i.e.HP Color Laserjet PS)""", TRUE
That's great!