By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,694 Members | 1,846 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,694 IT Pros & Developers. It's quick & easy.

lost in ASP & WSH!please help!

P: n/a
I am using the VBScript and WSH to get the existing
printer network. The code:

<script language="VBScript" type="text/VBScript">
Dim existing
Set WshNetwork = CreateObject("WScript.Network")

Set objPrinters = WshNetwork.EnumPrinterConnections

For i = 0 to objPrinters.Count - 1 Step 2
MsgBox objPrinters.Item(i+1)
Next
</script>

The code works, however, I wanna show it on my asp
webpage, how can i get the VBS variable and then use
response.write to show "objPrinter.Item" ???

Please help!!Thanks a lot!!!

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
your code - slightly modified - works
<%
Dim WshNetwork, objPrinters, i
Set WshNetwork = server.CreateObject("WScript.Network")
Set objPrinters = WshNetwork.EnumPrinterConnections
For i = 0 to objPrinters.Count - 1 Step 2
response.write objPrinters.Item(i+1) & "<br/>"
Next
%>

If you dont see any printers the reason could be as follows:
Your web page might be running as anonymous (generally the user context
would be IUSR_<machine name>). If the printer connections are attached to
the logged in user profile then IUSR_... won't have any. Change the
security on the ASP page - remove anonymous and turn ON Integrated. It
should work now.

"kyiu" <ka******@hkusua.hku.hk> wrote in message
news:06****************************@phx.gbl...
I am using the VBScript and WSH to get the existing
printer network. The code:

<script language="VBScript" type="text/VBScript">
Dim existing
Set WshNetwork = CreateObject("WScript.Network")

Set objPrinters = WshNetwork.EnumPrinterConnections

For i = 0 to objPrinters.Count - 1 Step 2
MsgBox objPrinters.Item(i+1)
Next
</script>

The code works, however, I wanna show it on my asp
webpage, how can i get the VBS variable and then use
response.write to show "objPrinter.Item" ???

Please help!!Thanks a lot!!!

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.