Announcement

Collapse
No announcement yet.

VBS error when running vbs script in a web page

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBS error when running vbs script in a web page

    I am trying to use a web page on our local intranet running on IIS server to add printers

    the following is the vbs

    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." & vbcrlf & " After Adding Your Remaining Printers,Please Reboot.")
    Else
    msgbox ("Printer " & pname & " Installed Successfully." & vbcrlf & " After Adding Your Remaining Printers,Please Reboot.")
    End If
    End Function

    yet when i run it from the iss server i get line 30, Activex cannot create object "wscript.network"

    if i run this locally from the local drive just as a html it works fine

    Any ideas?

    I appreciate your help

  • #2
    Re: VBS error when running vbs script in a web page

    WSH and ASP are two separate beasts. There are a number of limitations on running VBS from ASP. Otherwise, imagine the security holes.
    Cheers,

    Rick

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    2006-2099 R Valstar. This post is offered "as is" for discussion purposes only with no express or implied warranty of any kind including, but not limited to, correctness or fitness for use. Nothing herein shall be construed as advice. Attempting any activity based on information in this post is done at your own risk.

    Comment


    • #3
      Re: VBS error when running vbs script in a web page

      As Rick says there are big differences between WSH and ASP. What you are trying to do i think maybe possible but you need to look very closely at learning some more about ASP.
      Server 2000 MCP
      Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

      ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

      Comment

      Working...
      X