--- title: "How to: Clone a Printer" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "print queues [WPF]" - "cloning printers [WPF]" - "printers [WPF], cloning" - "print queues [WPF], cloning" - "cloning print queues [WPF]" ms.assetid: dd6997c9-fe04-40f8-88a6-92e3ac0889eb --- # How to: Clone a Printer Most businesses will, at some point, buy multiple printers of the same model. Typically, these are all installed with virtually identical configuration settings. Installing each printer can be time-consuming and error prone. The namespace and the class that are exposed with Microsoft .NET Framework makes it possible to instantly install any number of additional print queues that are cloned from an existing print queue. ## Example In the example below, a second print queue is cloned from an existing print queue. The second differs from the first only in its name, location, port, and shared status. The major steps for doing this are as follows. 1. Create a object for the existing printer that is going to be cloned. 2. Create a from the of the . The property of each entry in this dictionary is an object of one of the types derived from . There are two ways to set the value of an entry in this dictionary. - Use the dictionary's **Remove** and methods to remove the entry and then re-add it with the desired value. - Use the dictionary's method. The example below illustrates both ways. 3. Create a object and set its to "IsShared" and its to `true`. 4. Use the object to be the value of the 's "IsShared" entry. 5. Create a object and set its to "ShareName" and its to an appropriate . 6. Use the object to be the value of the 's "ShareName" entry. 7. Create another object and set its to "Location" and its to an appropriate . 8. Use the second object to be the value of the 's "Location" entry. 9. Create an array of s. Each item is the name of a port on the server. 10. Use to install the new printer with the new values. An example is below. [!code-csharp[ClonePrinter#ClonePrinter](~/samples/snippets/csharp/VS_Snippets_Wpf/ClonePrinter/CSharp/Program.cs#cloneprinter)] [!code-vb[ClonePrinter#ClonePrinter](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ClonePrinter/visualbasic/program.vb#cloneprinter)] ## See also - - - - - - [Documents in WPF](documents-in-wpf.md) - [Printing Overview](printing-overview.md)