Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i am getting this exception when i am trying to create printserver object. Here is my code

C#
PrintServer printServer = new PrintServer(@"\\" + printServerName);
PrintQueue printQueue = printServer.GetPrintQueue(printerName);


I trying to get the printers from another machine which is windows server 2012, same code works fine if i try to acess some OS based system. Any help will be appreciated. Thanks in advance
Posted

1 solution

I found the answer for this, and i know many others are also looking for this issue.

This issue was occuring due to windows feature/role "Print and Document service" is missing on the system. This role is required for managing multiple printers or print servers and migrating printers to and from other windows servers.

To add the role Go To Control Panel->Turn windows feature on or off->click on check box "Print and Document Service"->install.

See with network administrator for installing this rule if you unable to add it.

After adding the role you can able to create print server object and get the all the printqueues on respective server.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900