title: Getting The print servers in a network
body: <p>I want to write a PowerShell script to get all the print servers in a network.</p>
  
  <p>I have used the following LDAP query, but it returns only servers with network printers attached to it. But not other print servers that have a remote printer attached to it.
  Here's the code I used to get the print servers (But getting only the servers with n/w printers)</p>
  
  <pre><code>Import-Module ActiveDirectory
  [array]$testarray = Get-ADObject -LDAPFilter "(&amp;(&amp;(&amp;(uncName=*)(objectCategory=printQueue))))" -properties *|Sort-Object -Unique -Property servername |select servername
  $testarray
  </code></pre>