
Problem with AddPrinterConnection
Hi,
I try to print a document on the server using ASP
this is the VBScript code i'm using;
objFS = CreateObject("Scripting.FileSystemObject")
Set objWSHNet = CreateObject("WScript.Network")
objWSHNet.AddPrinterConnection
"LPT1",<PrinterPath>,false,"<login>","<password>"
Set objPrinter = objFS.CreateTextFile("LPT1:", True)
objPrinter.Write("I want to print this text")
objPrinter.Close
objWSHNet.RemovePrinterConnection "LPT1:"
Set objWSHNet = Nothing
Set objFS = Nothing
Set objPrinter = Nothing
When i replace the tag <> with real info, i receive this error ;
WSHNetwork.AddPrinterConnection error '80070520'
A specified logon session does not exist. It may already have been
terminated
Anyone know why? I'm sure that the printer is correctly installed and use
the port lpt1 and i have admin access to the server.
I'm using Windows 2000 with sp1 and IIS 5. Any help would be greatly
appreciate.
Thanks