Score:0

PowerShell - Get-Printer for remote computer will not return shared printers

eh flag

I am trying to get a list of shared printers running on the organization PCs I am using the following with is working great when running it locally (Win10 or 2019): Get-Printer the results are:

PS H:\> Get-Printer |
    fl Name
  1. Name : OneNote (Desktop)
  2. Name : OneNote for Windows 10
  3. Name : Xerox AltaLink C8045 PCL6 - A3 Color
  4. Name : WorkCentre 5330
  5. Name : Microsoft XPS Document Writer
  6. Name : Microsoft Print to PDF
  7. Name : IT-Printer
  8. Name : Fax
  9. Name : \printers\einat

when adding the variable -ComputerName ws-idanb I am getting only local printers the one from \\printers is missing....

  1. Name : OneNote (Desktop)
  2. Name : OneNote for Windows 10
  3. Name : Xerox AltaLink C8045 PCL6 - A3 Color
  4. Name : WorkCentre 5330
  5. Name : Microsoft XPS Document Writer
  6. Name : Microsoft Print to PDF
  7. Name : IT-Printer
  8. Name : Fax

due to this issue, I an unable run this on the AD server using a script on all computers on a specific OU and must run it locally on each PC...

will appreciate if someone will know if I am doing something wrong and how can I still find the printers which are installed using the printers server.

this should be the command I would like to run...

Get-Printer -ComputerName HOST-NAME |
    where Shared -eq $true |
    fl Name > \\PATH\$env:computername.txt

Thanks, Idan

cn flag
That is expected behavior. Network-connected printers that are shared on another host will not exist in your PowerShell remote session because you aren't creating the connection to the printer on other host.
Score:0
im flag
DKU

Have you tried with Invoke-Command script block to get the list of the printer available in the remote machines. Thanks

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.