views:

272

answers:

3

I have a WCF service hosted on a Windows Service application and it should return all installed printers on the machine it is hosted on. I have used System.Drawing.Printing.PrinterSettings.InstalledPrinters to retrieve the list of installed printers but I don't know why in Windows Vista it doesn't return all printers.

The host Windows service is run using an account which is a member of Administrators group, has "Log on as a Service" privilege and added app.Manifest with the "requireAdministrator" execution level.

UPDATE: If I use the InstalledPrinters property on a windows application in Vista it returns all printers!

A: 

Do you have any printers installed for the user running the application that the other member does not have installed?

This might be one avenue to check, since any printers that are setup just for the user you are running the application as may not be setup for the user you are running the service as.

(this is, of course, a moot point if you are running both as the same user)

Daemonic
You are right. The problem is that my service is running under a different user account. Is there anyways to install printers for the user account that my service uses, without having to logging in to that account?
Mohammadreza
A: 

You should install your printers locally to use them from a Windows service. When you start the Add Printer wizard you get to choose whether to add a local or remote printer.

Tony Edgecombe
A: 

Thanks you, Tony Edgecombe give the answer!

usabcd