Mark Brown's Blog

TFS, Visual Studio, SQL Server, BizTalk, SharePoint, .Net, and more ...

Install a remote printer via a Hyperlink in HTML

Ever tried to install a printer by just giving users a link?  Well here is a small snippet of one way to do this.   Please note that since you are interacting with the OS (outside the browser) that you may receive security warnings.   This has been tested on Vista SP1 x86 32 bit with IE7.

Code

<html>
<head>
<script type="text/vbscript">
function AddP(pName)
msgbox "Start"
Set WshNetwork = CreateObject("Wscript.Network")
WshNetwork.AddWindowsPrinterConnection pName
msgbox "Finished"
end function
</script>
</head>
<body>
<a href='#' language="vbscript" onclick="AddP('\\Home-PC\HP Photosmart 3300 series')">Add printer</a>
</body>
</html>

 Please note that above the a href should be ="#" not single quotes.

Published Friday, February 13, 2009 8:03 AM by mab

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Install a remote printer via a Hyperlink in HTML - Click &amp; Solve said:

February 13, 2009 10:09 AM
 

Toner cartridges said:

Every piece of data necessary to succeed, from basic tools and commands to vocabulary and layout creation, is packed into the nice post.

July 30, 2009 8:05 AM

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Submit

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker