TFS, Visual Studio, SQL Server, BizTalk, SharePoint, .Net, and more ...
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.
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