I am an information manager for the Air Force and one of the parts that my job entales is that I help the other members of my unit with computer issues. I end up gettig a lot of questions on adding printers from the network onto individual computers. In order to curtail the need to answer the same question over and over I am attempting to create a web page that would allow the user to click on a button that would automatically add the printer.

I don't know a whole lot about VBScript and the only reason that I am going with this form of code is because I found a premade page that worked for what I wanted it to do and it was already written in that format.

And here is where my need for help comes in. I was able to change the premade code so that it applied to the printers that I have on my server and the logic in my head says that it should work after that, but when I load the page I get an error and nothing happens past that. I am going to post the code that I am using and I would really appreciate it if some one with any knowledge of VBScript could look at it and see if there is some kind of error in my coding. Any help would be greatly appreciated.

-------------------Code To Follow------------------------

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Printer Management Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<SCRIPT LANGUAGE="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>
<body>
<p>&nbsp;</p>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="1">
  <tr>
    <td valign="top" bgcolor="#999999">
      <table width="600" border="0" cellspacing="1" cellpadding="0">
        <tr bgcolor="#CCCCCC">
          <td colspan="4"><table width="600" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="330"><strong><font size="1" face="helvetica, verdana, arial">&nbsp;Description</font></strong></td>
                <td width="200"><strong><font size="1" face="helvetica, verdana, arial"> &nbsp;Printer
                      Name (Print Queue)</font></strong></td>
                <td width="70"><strong><font size="1" face="helvetica, verdana, arial">&nbsp;</font></strong></td>
                <td width="100">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td width="330"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Squadron (Building 3077)</font></td>
          <td width="200"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Black and White</font></td>
          <td width="70" bgcolor="#FFFFFF">
            <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
              <input type="button" name="Button" value="Add" style="width:40; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt; color:#000000; background-color:#E8E8E8;" onClick=addPrint('\\lewia7-prtp-200\lewipr1ws003')>
              </font></div>
          </td>
          <td width="100" bgcolor="#FFFFFF"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
              <input type="button" name="Button3" value="Remove" style="width:70; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt; color:#000000; background-color:#E8E8E8;" onClick=delPrint('\\lewia7-prtp-200\lewipr1ws003')>
              </font></div>
          </td>
        </tr>
        <tr bgcolor="#EBEBEB">
          <td width="330"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Squadron (Building 3077)</font></td>
          <td width="200"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Color Printer</font></td>
          <td width="70">
            <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
              <input type="button" name="Button2" value="Add" style="width:40; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt; color:#000000; background-color:#E8E8E8;" onClick=addPrint('\\lewia7-prtp-200\lewipr1ws005')>
              </font></div>
          </td>
          <td width="100"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
              <input type="button" name="Button24" value="Remove" style="width:70; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt; color:#000000; background-color:#E8E8E8;" onClick=delPrint('\\lewia7-prtp-200\lewipr1ws005')>
              </font></div>
          </td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td width="330"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Weather Station (Building 3082)</font></td>
          <td width="200"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Black and White Printer</font></td>
          <td width="70">
            <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
              <input type="button" name="Button22" value="Add" style="width:40; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt; color:#000000; background-color:#E8E8E8;" onClick=addPrint('\\lewia7-prtp-200\lewipr1ws004')>
              </font></div>
          </td>
          <td width="100"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
              <input type="button" name="Button222" value="Remove" style="width:70; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt; color:#000000; background-color:#E8E8E8;" onClick=delPrint('\\lewia7-prtp-200\lewipr1ws004')>
              </font></div>
          </td>
        </tr>
        <tr bgcolor="#EBEBEB">
          <td width="330"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Weather Station (Building 3082)</font></td>
          <td width="200"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;Color Printer</font></td>
          <td width="70">
            <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
              <input type="button" name="Button23" value="Add" style="width:40; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt; color:#000000; background-color:#E8E8E8;" onClick=addPrint('\\lewia7-prtp-200\lewipr1ws004')>
              </font></div>
          </td>
          <td width="100"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
              <input type="button" name="Button223" value="Remove" style="width:70; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt; color:#000000; background-color:#E8E8E8;" onClick=delPrint('\\lewia7-prtp-200\lewipr1ws004')>
              </font></div>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>