Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Allow users to add printers from SharePoint

  Asked By: Gaurang    Date: Jul 15    Category: Sharepoint    Views: 16985

I have been tasked with finding a way for users to add printers from within
SharePoint. (this was the issue with my UNC question the other day.)

While surfing around, I found this link;
social.technet.microsoft.com/.../9e752d\
f8-b60f-47c3-b862-08b9e9d9a03e which has a great solution, with the exception
that our users aren't really savvy enough to know to click "Run" and not "save."
(Think of your 92 year old grandmother using the computer, and that's about the
computer skill level of many of our users.) I wanted something that was more
simple and straightforward. While reading the comments I noticed some code near
the bottom that looked like it would work much better. But there is a hiccup.
When a user clicks on a button assigned to add or delete a printer, they get the
error message; ActiveX component can't create object: 'WScript.Network'

Below is a sample of the code I copied and modified. Is there a workaround to
this, or a different way to set this?

<SCRIPT type="text/vbscript">
Function delPrint(pname)
Set objNetwork = CreateObject("Wscript.Network")
confDel = msgbox ("Do you want to remove " & pname & " ?",vbYesNo)
If confDel = 6 Then
objNetwork.RemovePrinterConnection pname
msgbox (pname & " Has Been Removed.")
Else
msgbox (pname & " Will Not Be Removed.")
End If
End Function

Function addPrint(pname)
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection pname
mkDef = msgbox ("Do you want " & pname & " to be your default printer?", 292,
"Default Printer Status")
If mkDef = 6 Then
WshNetwork.SetDefaultPrinter pname
msgbox ("Printer " & pname & " Installed As Default Successfully.")
Else
msgbox ("Printer " & pname & " Installed Successfully.")
End If
End Function
</SCRIPT>

<table cellspacing="0" border="0" width="100%">
<tr>
<td class="ms-pagebreadcrumb">
<asp:SiteMapPath SiteMapProvider="SPContentMapProvider" id="ContentMap"
SkipLinkText="" runat="server"/>
</td>
</tr>
<tr>
<td>
<table width="100%" cellpadding=0 cellspacing=0 style="padding: 5px 10px 10px
10px;">
<tr>
<td valign="top" width="70%">
<table border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td valign="top" bgcolor="#999999">
<table border="0" cellspacing="1" cellpadding="0">
<tr bgcolor="#AAAAAA">
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><strong><font size="1" face="helvetica, verdana,
arial"> 4th
Floor Printers</font></strong></td>
<td><strong><font size="1" face="helvetica, verdana,
arial"> 
Location</font></Strong></td>
<td style="width: 84px"><strong><font size="1" face="helvetica,
verdana, arial">
  Color / B&W</font></Strong></td>
<td><strong><font size="1" face="helvetica, verdana, arial">
 Printer Name (Print Queue)</font></strong></td>
<td><strong><font size="1" face="helvetica, verdana,
arial"> </font></strong></td>
<td style="width: 75px"> </td>
</tr>
<tr bgcolor="#EBEBEB">
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
 Konica Minolta 600 </font></td>
<td class="style1"> 4th Floor Production Room</td>
<td class="style1" style="width: 84px"> Color </td>
<td><font size="1" face="Verdana, Arial, Helvetica,
sans-serif"> 4e2</font></td>
<td bgcolor="#FFFFFF">
<div align="center"><font size="1" face="Verdana, Arial, Helvetica,
sans-serif">
<input type="button" name="Button6" value="Add" style="width:40;
font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt; color:#000000;
background-color:#E8E8E8;" onClick=addPrint('\\cecprt\4e2')>
</font></div>
</td>

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Allow users to add printers from SharePoint Or get search suggestion and latest updates.




Tagged: