Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Mapping Printers in HTML

Options
  • 09-06-2008 11:08am
    #1
    Registered Users Posts: 884 ✭✭✭


    Hi there,

    I am trying to create a link so that users can map a printer just by clicking on the link.

    If a user goes to Start - Run - Types in '\\server\printer' and clicks OK

    I have put the following code on a HTML page but it doesn't work
    <td><a href="\\server\printer">\\server\printer</a><td>
    

    Does anyone have any ideas?


Comments

  • Registered Users Posts: 2,858 ✭✭✭Duckjob


    Where is the printer connected? To the client or to the server ?

    What is the bigger aim of what you are doing?


  • Registered Users Posts: 568 ✭✭✭phil


    The only way I'm aware of doing this is through ActiveX.

    Look into:

    - The ActiveX WScript.Network control
    - The AddWindowsPrinterConnection function

    Bear in mind that ActiveX support isn't ubiquitous across browsers and AFAIK is IE only.

    Phil.


  • Registered Users Posts: 884 ✭✭✭Cork Skate


    Duckjob wrote: »
    Where is the printer connected? To the client or to the server?

    Server
    What is the bigger aim of what you are doing?

    Just want a page on the intranet that will allow users to map printers easily. "Click'n'Print" just to make life easy for them.


  • Registered Users Posts: 884 ✭✭✭Cork Skate


    phil wrote: »
    The only way I'm aware of doing this is through ActiveX.

    Look into:

    - The ActiveX WScript.Network control
    - The AddWindowsPrinterConnection function

    Bear in mind that ActiveX support isn't ubiquitous across browsers and AFAIK is IE only.

    Phil.

    Ah, dont think that would be an option. Not on the stanard image user in work. Cheers for the help though.


  • Registered Users Posts: 6,494 ✭✭✭daymobrew


    Would it be possible to have a small Windows app downloaded from the intranet site and then run? This would then have access to system settings and could do the mapping.


  • Advertisement
  • Moderators, Music Moderators Posts: 23,359 Mod ✭✭✭✭feylya


    What about using some VBScript in the HTML?
    Set wshNetwork = WScript.CreateObject("WScript.Network")
    wshNetwork.AddWindowsPrinterConnection "\\server\printer"
    


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Here's a script I wrote for our helpdesk internal site which does the trick. Only works in IE I assume:
    <script type="text/vbscript">
    	
    	Function connect_printer(printerName, serverName)
    		On Error Resume Next
    		
    		strUNCPrinter = "\\" & serverName & "\" & printerName
    		
    		Set objNetwork = CreateObject("WScript.Network")
    		objNetwork.AddWindowsPrinterConnection strUNCPrinter
    		If Err <> 0 Then
    			MsgBox "The selected printer could not be connected. Please contact the helpdesk for assistance in connecting this printer", 0, "Connection Error"
    		Else 
    			myVar = MsgBox("You have been connected to the selected printer. Do you wish to set this as your default printer?", vbYesNo, "Connection Status")
    			If myVar = 6 Then
    				objNetwork.SetDefaultPrinter strUNCPrinter
    				MsgBox printerName & " is now your default printer", vbOKOnly, "Connection Status"
    			End If
    		End If
    		Return false
    	End Function
    	
    </script>
    

    This line:
    Set objNetwork = CreateObject("WScript.Network")

    May trigger security warnings in IE, so the site will need to be on the trusted sites list. This can be set in group policy for the domain.


Advertisement