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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Install printer via script

Status
Not open for further replies.

james0816

Programmer
Jan 9, 2003
295
0
0
US
If I open up internet explorer and I type the UNC path for a printer (i.e. \\servername\printername), it will ask me to install it if not already installed.

I would like to add this to an informational web page I am building. So far, I can not get it to work via a web page. All I get is a message saying "page cannot be displayed"

Can someone lend some advice on this?

thx kindly
 
Try using file:///\\servername\printername


Stamp out, eliminate and abolish redundancy!
 
Hmm, it works for opeing files but not for printers.
Yet the link sent is correctly interpreted as it will show a printer icon on the address line in IE and if you click on the address line then hit enter it will bring up the install prompt.
It must be security shutting the request down when the request originates from HTML but when a user action is used it allows it to go through.

The only thing I could suggest is using an .hta file to execute the command client-side. The hta file would present an ActiveX warning the client would have to OK before allowing the command but if they allow it it would execute with client-side permissions.


Stamp out, eliminate and abolish redundancy!
 
i'm affraid that is a little out of my league. Can you lend some more assistance on this .hta file stuffs?
 
I did some testing and the most I could manage was to pull up the explorer window on that server but could not get the printer object to open. There may be a way to do it but nothing occurs to me now.

Here is an example of the .hta
Save it as a file on your desktop with the extension .hta and double click to execute.
Code:
<html>
<head>
<HTA:APPLICATION ID="oHTA"
      VERSION="1.0"
     APPLICATIONNAME="AmPost"
     BORDER="thin"
     BORDERSTYLE="normal"
     CAPTION="yes"
     CONTEXTMENU="no"
     ICON=""
     INNERBORDER="yes"
     MAXIMIZEBUTTON=no"
     MINIMIZEBUTTON="no"
     NAVIGABLE="yes"
     SCROLL="no"
     SCROLLFLAT="yes"
     SELECTION="yes"
     SHOWINTASKBAR="yes"
     SINGLEINSTANCE="yes"
     SYSMENU="yes"
     WINDOWSTATE="normal"
/>

<script language="VBScript">

Dim objShell

Sub Run(Name)
Msgbox Name
  Set objShell = CreateObject("WScript.Shell")
  objShell.Run Name
  On Error Resume Next
  Set objShell = Nothing  
End Sub

</script>
</head>
<body>
<a href="javascript:Run('file://c:/winnt/explorer.exe \\\\servername');">Install Printer</a>
</body>
</html>


Stamp out, eliminate and abolish redundancy!
 
any recent luck on this one? I'm looking to install a printer via web page...

"...your mom goes to college..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top