title: C# - Enumerating network printers on remote machine
body: <p>I am writing an application to check if a network printer from a print server is connected to a remote machine, but having trouble with the remote part... I'm using System.Printing and passing in the remote hostname/IP address through the 'compID' variable. The problem I'm having is that the code always returns the networked printers on my LOCAL machine rather than the remote machine:</p>
  
  <pre><code>EnumeratedPrintQueueTypes[] compEnumerationFlags = { EnumeratedPrintQueueTypes.Connections };
  
  PrintServer compPrinters = new PrintServer("\\\\" + compID);
  PrintQueueCollection printQueuesOnComputer = compPrinters.GetPrintQueues(compEnumerationFlags);
  
  List&lt;string&gt; compPrinterList = new List&lt;string&gt;();
  
  foreach (PrintQueue printer in printQueuesOnComputer)
      {
          compPrinterList.Add(printer.Name);
      }
  
  string csv = string.Join("\n", compPrinterList.ToArray());
  Microsoft.VisualBasic.Interaction.MsgBox(csv);
  </code></pre>
  
  <p>Forgive the messy bit at the end there, but it's just a quick and dirty way for me to see what the results are for the moment.</p>
  
  <p>The strange thing is that if I change the 'compID' variable to our actual print server and change the flags from "Connections' to 'Shared', then the code successfully returns all the shared printers from our print server.</p>
  
  <p>All this is running as an admin on our domain, so that should hopefully not be an issue here. Is there something simple I'm overlooking or is there some sort of restriction on the types of machines I can connect to with PrintServer?</p>