Click to See Complete Forum and Search --> : Installing Printers via VB and ASP


wmac222
04-05-2005, 02:13 PM
I have developed a no-brainer web page that my users can select the printer they want installed and whether or not it will be their default printer. When they click the 'Install Printer' button, I would like the following VB script to be executed, any suggestions on how I can run this script from the 'called' <form action=xxx.asp method=post> ASP page?

*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!

Dim objNetwork, bnDefaultPrinter

bnDefaultPrinter = Request.Form ("DefaultPrinter")

Set objNetwork = CreateObject("Wscript.Network")

objNetwork.RemovePrinterConnection "\\[server name]\[printer name]"
objNetwork.AddWindowsPrinterConnection "\\[server name]\[printer name]"

If bnDefaultPrinter = 0 Then
objNetwork.SetDefaultPrinter "\\[server name]\[printer name]"
End if

!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*

Thanks for the assist!

lmf232s
04-06-2005, 01:40 PM
well when they submit the form after clicking the submit button, just fire off that piece of code. Will that not work?

wmac222
04-06-2005, 02:16 PM
No, that would be too easy. I get following message:

..> WSHNetwork.RemoveNetworkDrive error '800708ca'

..> This network connection does not exist.

Any suggestions??

Thanks for the assist.

lmf232s
04-06-2005, 02:37 PM
hey i just googled this

WSHNetwork.RemoveNetworkDrive error '800708ca'

and it came back with alot of hits, i was searching through some of them and it appears that other people have had this problem as well. WHile i did not read any that had a working solution, im sure if you look long enough you will find one that does.

Give it a shot.