views:

25

answers:

2

Hey All,

I'm trying to write a simple web interface to allow users to install one of a few predefined network printers. I had initally thought this would be a simple task, as I can easily install printers via the run command by hitting the printer dead on (\printserv\printername). I had planned to either use that in the tag, or prefix it with a "file://" but both methods result in the following error

"\printserv\printername is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions."

I know I have permission to use this resource as I can install it via the run command. Any idea what I may be doing wrong, or an alternative solution?

+1  A: 

The problem is that installing a printer is a "system" kind of activity probably requiring administrator access (it may be easy for you, but maybe not for others!). Now you're planning to run this operation through a browser!

Please consider this: If it were possible to run arbitrary administrative commands through your browsers, the Russian Mafia would already own all of your machines. Microsoft has punched enough holes in security that many, many Windows PCs are hacked, but it's still not quite as bad as the hole you would like to use.

A browser is a program, a way to look at pages on the 'net. It's not an administrative command interface for your PC.

Yet.

There is some trickery you can do with JavaScript in IE that will give you access to a lot of the underlying system. But whenever I post code, people yell at me. I'm not sure if it will do your printer installation for you, but if you insist, then try to get that code from somebody else. I honestly don't have it handy and would have to go digging deeply for it.

Carl Smotricz
I hear you man, and agree... if anyone in the future is curious here's some of that trickery you were talking about. I don't really feel comfortable using it.<script type="text/javascript">var WshNetwork = new ActiveXObject("WScript.Network"); var PrinterPath = "\\\\printserv\\printername"; WshNetwork.AddWindowsPrinterConnection(PrinterPath); WshNetwork.SetDefaultPrinter(PrinterPath); </script>
gerges
+1  A: 

Opening local locations - whether on the filesystem or in the network - has become awfully difficult due to security reasons. I have yet to find a method that does this in Firefox for myself as a developer (with full access to the browser) so I can add direct links to my Web development IDE while browsing my web apps in debug mode.

I would recommend to detect the user's operating system (XP/2000/Vista/7/Whatever), display the network address in question big and fat in the center of the screen:

\printserv\printername

and then display customized step-by-step installation instructions:

  1. Click the "Start" button.
  2. Click "Run...."
  3. Copy and paste the address above into the field.
  4. Click "OK"

etc.

Pekka