Show a list of Network and Local Printers in .Net using C# and VB.NET

← PrevNext →

Last updated: 11th July 2025

With Microsoft .NET, you can easily fetch a list of installed printers, both local and network, using PrinterSettings or WMI (Win32_Printer). These methods work seamlessly in modern Windows Forms and intranet web apps for remote printer access and management.

🚀 These are compatible with modern .NET Frameworks like .NET Core and .NET 6/8 (with necessary adjustments for WMI).

In this guide, you'll learn two effective approaches to list printers installed on a server using .NET. These printers may be locally installed or shared across the network. Whether you're building a Windows Forms or intranet application, these methods help access printer details reliably for both server-side and remote setups.

printers

01) The First Method

The PrinterSettings class in the System.Drawing.Printing namespace allows you to retrieve a list of all printers installed on the system. In the example below, a ComboBox and a ListBox are used to display the printer names on a web page. The printer list is dynamically populated into both controls for user selection and viewing.

First, drag and drop a "ComboBox" and a "ListBox" control on the form.

Code in C#

Copy and paste the below code and run application. It will show you a list of printers installed in your computer.

using System;
using System.Windows.Forms;

private void Form1_Load(object sender, EventArgs e) { 
    PrinterList();
}

private void PrinterList()
{
    // POPULATE THE COMBO BOX.
    foreach (string sPrinters in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
    {
        cmbPrinterList.Items.Add(sPrinters);
    }

    // POPULATE THE LIST BOX.
    foreach (string sPrinters in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
    {
        lstBoxPrinters.Items.Add(sPrinters);
    }
}
Code in VB.NET
Option Explicit On

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    PrinterList()
End Sub

Private Sub PrinterList()
    Dim sPrinters As String = ""

    ' Polulate the combo box.
    For Each sPrinters In System.Drawing.Printing.PrinterSettings.InstalledPrinters
        cmbPrinterList.Items.Add(sPrinters)
    Next

    ' Populate the list box.
    For Each sPrinters In System.Drawing.Printing.PrinterSettings.InstalledPrinters
        lstBoxPrinters.Items.Add(sPrinters)
    Next
End Sub

02) The Second Method

Now this method uses the Windows Management Instrumentation or the WMI interface. It’s a technology used to get information about various systems (hardware) running on a "Windows Operating System".

Ref: Learn more about Windows Management Instrumentation (WMI).

Add the System.Management Reference in .NET

Before using Windows Management Instrumentation (WMI) in your .NET project, you’ll need to add the System.Management assembly:

1) In Solution Explorer, right-click your project and choose "Add Reference…".

2) In the Reference Manager window, go to the .NET tab.

3) Search for "System.Management" in the component list.

4) Check the box next to it, then click OK to include it in your project.

This enables access to WMI classes like Win32_Printer, which are crucial for retrieving system-level data in C# or VB.NET.

C#

In this example, I am using two separate ComboBoxes to show the Network and Local printers seperately.

👉 To test this method, please check if there are printers installed on the Network.

using System;
using System.Windows.Forms;
using System.Management;

namespace Printers
{
    public partial class Form1 : Form
    {
        public Form1() {InitializeComponent();}

        private void Form1_Load(object sender, EventArgs e) { 
            PrinterList();
        }

        private void PrinterList()
        {
            // USING WMI. (WINDOWS MANAGEMENT INSTRUMENTATION)

            System.Management.ManagementScope objMS =
                new System.Management.ManagementScope(ManagementPath.DefaultPath);
            objMS.Connect();

            SelectQuery objQuery = new SelectQuery ("SELECT * FROM Win32_Printer");
            ManagementObjectSearcher objMOS = new ManagementObjectSearcher(objMS, objQuery);
            System.Management.ManagementObjectCollection objMOC = objMOS.Get();

            foreach (ManagementObject Printers in objMOC)
            {
                if (Convert.ToBoolean(Printers["Local"]))       // LOCAL PRINTERS.
                {
                    cmbLocalPrinters.Items.Add(Printers["Name"]);
                }
                if (Convert.ToBoolean(Printers["Network"]))     // ALL NETWORK PRINTERS.
                {
                    cmbNetworkPrinters.Items.Add(Printers["Name"]);
                }
            }
        }
    }
}
VB.NET
Option Explicit On
Imports System.Management

Public Class Form1
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        PrinterList()
    End Sub

    Private Sub PrinterList()
        'POPULATE A COMBO BOX WITH PRINTER LIST.
        For Each sPrinters In System.Drawing.Printing.PrinterSettings.InstalledPrinters
            cmbPrinterList.Items.Add(sPrinters)
        Next

        'POPULATE A LIST BOX WITH PRINTER LIST.
        For Each sPrinters In System.Drawing.Printing.PrinterSettings.InstalledPrinters
            lstBoxPrinters.Items.Add(sPrinters)
        Next

        ' USING WMI. (Windows Management Instrumentation)
        Dim objMS As System.Management.ManagementScope = _
            New System.Management.ManagementScope(ManagementPath.DefaultPath)
        objMS.Connect()

        Dim objQuery As SelectQuery = New SelectQuery ("SELECT * FROM Win32_Printer")
        Dim objMOS As ManagementObjectSearcher = New ManagementObjectSearcher(objMS, objQuery)
        Dim objMOC As System.Management.ManagementObjectCollection = objMOS.Get()

        For Each Printers As ManagementObject In objMOC
            If CBool(Printers("Local")) Then                        ' LOCAL PRINTERS.
                cmbLocalPrinters.Items.Add(Printers("Name"))
            End If
            If CBool(Printers("Network")) Then                      ' ALL NETWORK PRINTERS.
                cmbNetworkPrinters.Items.Add(Printers("Name"))
            End If
        Next Printers
    End Sub
End Class
Conclusion

You've now explored two practical approaches to listing both network and local printers using .NET, leveraging PrinterSettings and WMI (Win32_Printer). Whether you're building a Windows Forms app or an intranet tool, these methods equip you to access printer data efficiently and reliably. I hope the examples provided here help streamline your development and offer a solid foundation for further customization.

← PreviousNext →