GET-IT: TEAMS DAY | 1-Day Free Virtual Conference all about Teams. Here on Petri.com - 8/12/20 GET-IT: TEAMS DAY - 8/12/20

VBS error when running vbs script in a web page

Home Forums Scripting General Scripting VBS error when running vbs script in a web page

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    neo3114
    Member
    #122733

    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

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.