bluematter
asked on
WScript Error
When I try to run this and other WSH scripts I get this error.
Any Idea?
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'WScript'
<%
Set NWPrinter = WScript.CreateObject("WScr ipt.Networ k")
Set NWPPath = "\\Server\Printer"
NWPrinter.AddWindowsPrinte rConnectio n(NWPPath)
Set rc = NWPrinter.AddWindowsPrinte rConnectio n(NWPPath)
If Not rc then
WScript.Echo("Unable to install printer at this time.")
End If
NWPrinter.SetDefaultPrinte r NWPPath
%>
Any Idea?
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'WScript'
<%
Set NWPrinter = WScript.CreateObject("WScr
Set NWPPath = "\\Server\Printer"
NWPrinter.AddWindowsPrinte
Set rc = NWPrinter.AddWindowsPrinte
If Not rc then
WScript.Echo("Unable to install printer at this time.")
End If
NWPrinter.SetDefaultPrinte
%>
ASKER
Now have got error
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: '[string: "\\Server\Printer"]'
/printer.asp, line 3
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: '[string: "\\Server\Printer"]'
/printer.asp, line 3
How about this?
<%
Set NWPrinter = Server.CreateObject("WScri pt.Network ")
NWPPath = "\\Server\Printer"
Set rc = NWPrinter.AddWindowsPrinte rConnectio n(NWPPath)
If Not rc then
WScript.Echo("Unable to install printer at this time.")
End If
NWPrinter.SetDefaultPrinte r NWPPath
Set NWPrinter = Nothing
%>
hongjun
<%
Set NWPrinter = Server.CreateObject("WScri
NWPPath = "\\Server\Printer"
Set rc = NWPrinter.AddWindowsPrinte
If Not rc then
WScript.Echo("Unable to install printer at this time.")
End If
NWPrinter.SetDefaultPrinte
Set NWPrinter = Nothing
%>
hongjun
ASKER
Now have got a very helpful error.
Error Type:
(0x80070709)
/printer.asp, line 4
<%
Set NWPrinter = Server.CreateObject("WScri pt.Network ")
NWPPath = "\\server\Printer"
Set rc = NWPrinter.AddWindowsPrinte rConnectio n(NWPPath)
If Not rc then
WScript.Echo("Unable to install printer at this time.")
End If
NWPrinter.SetDefaultPrinte r NWPPath
Set NWPrinter = Nothing
%>
Error Type:
(0x80070709)
/printer.asp, line 4
<%
Set NWPrinter = Server.CreateObject("WScri
NWPPath = "\\server\Printer"
Set rc = NWPrinter.AddWindowsPrinte
If Not rc then
WScript.Echo("Unable to install printer at this time.")
End If
NWPrinter.SetDefaultPrinte
Set NWPrinter = Nothing
%>
Try this
<%
Set NWPrinter = Server.CreateObject("WScri pt.Network ")
NWPPath = "\\server\Printer"
If Not NWPrinter.AddWindowsPrinte rConnectio n(NWPPath) then
WScript.Echo("Unable to install printer at this time.")
End If
NWPrinter.SetDefaultPrinte r NWPPath
Set NWPrinter = Nothing
%>
hongjun
<%
Set NWPrinter = Server.CreateObject("WScri
NWPPath = "\\server\Printer"
If Not NWPrinter.AddWindowsPrinte
WScript.Echo("Unable to install printer at this time.")
End If
NWPrinter.SetDefaultPrinte
Set NWPrinter = Nothing
%>
hongjun
ASKER
Same Error...... Bugger.... ;o(
(0x80070709)
/printer.asp, line 4
(0x80070709)
/printer.asp, line 4
ASKER
How could I check to see if the Wscript object was installed on the server?
How about this?
<%
On Error Resume Next
Set NWPrinter = Server.CreateObject("WScri pt.Network ")
NWPPath = "\\server\Printer"
NWPrinter.AddWindowsPrinte rConnectio n NWPPath
If Err.Count <> 0 Then
Response.Write "Unable to install printer at this time."
Else
NWPrinter.SetDefaultPrinte r NWPPath
End If
Set NWPrinter = Nothing
%>
hongjun
<%
On Error Resume Next
Set NWPrinter = Server.CreateObject("WScri
NWPPath = "\\server\Printer"
NWPrinter.AddWindowsPrinte
If Err.Count <> 0 Then
Response.Write "Unable to install printer at this time."
Else
NWPrinter.SetDefaultPrinte
End If
Set NWPrinter = Nothing
%>
hongjun
ASKER
I get the "Unable to install printer at this time."
And the server and printer is available.
And the server and printer is available.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes I had. I am currently rebulding my 2000 server so I will try it again from a fresh install. Will relpy in a day or two.
ASKER
After reinstalling the server and installing WScript 5.6 I tried it again.
The code to install the printer only work's when running through a VBS file & not via ASP. I believe this is a limitation to WScript 5.6. I can use other functions of the OCX ok Like mapping & unmapping network drives viewing network shares etc.
The MSN community is quite good.
http://communities.msn.com/windowsscript
The code to install the printer only work's when running through a VBS file & not via ASP. I believe this is a limitation to WScript 5.6. I can use other functions of the OCX ok Like mapping & unmapping network drives viewing network shares etc.
The MSN community is quite good.
http://communities.msn.com/windowsscript
<%
Set NWPrinter = Server.CreateObject("WScri
'''''
%>
hongjun