How can I get/set default printers on a per-user basis in Terminal Services with C#?

Posted by Charlie on Stack Overflow See other posts from Stack Overflow or by Charlie
Published on 2010-06-16T03:35:53Z Indexed on 2010/06/16 3:42 UTC
Read the original article Hit count: 264

Filed under:
|
|
|

I want to be able to get and set the default printer for users within Windows Terminal Services, but I don't see any relevant functions. (The closest I've seen is RDS User Config, but it doesn't appear to do what I need.) It can be done by name or by ID (however necessary). For example, something like this pseudocode:

For each user, u:
   p = u.GetDefaultPrinter()
   if p.name=='Inkjet' then:
      p2 = GetPrinterByName('Laser')
      u.SetDefaultPrinter( p2 )

© Stack Overflow or respective owner

Related posts about c#

Related posts about Windows