PDA

View Full Version : WSript not working in an ASP page (W2K)



samyukthas
07-31-2006, 10:29 PM
Hi All,

I have copied a small code from a .vbs file into an ASP page, which enumerates all printer connections of a particular machine. But the code is throwing an errorr with number : 0x80041003.

Here is the code which i used in my ASP page

<%
strComputer = "hschbscmro5028"
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer")

For Each objPrinter in colInstalledPrinters
response.write objPrinter.Name
response.write objPrinter.Location
Next
%>

Please let me know where i have gone wrong exactly.
Any help is appreciated.

Thanks
Samyu

Brf
08-01-2006, 06:29 AM
I already answered this up in the W2K forum. Didnt you like my answer?