Get-Printer only shows local printers

This topic contains 6 replies, has 4 voices, and was last updated by Profile photo of Avi Arditi Avi Arditi 2 years, 1 month ago.

  • Author
    Posts
  • #20077
    Profile photo of Avi Arditi
    Avi Arditi
    Participant

    hi all,

    on our network on a windows 8.1 PC I am running: Get-Printer -ComputerName xxxxx

    I only get the local printers it doesn't return the network printers.
    I have done lots of searching and couldn't find anything about this or more to the point about this problem.

    Any ideas ?

  • #20080
    Profile photo of Alexander Johansson
    Alexander Johansson
    Participant

    If you run "Get-Printer" on your localhost as the logged in user you will also see your network printers.
    But if you run it as an administrator you won't see them.

    Why?
    Because network printers that are shared from another server are per user, when you log in as a user which has the network printer mapped on a computer
    it will be created in that users session.

    The same thing happens when you try to use "Get-Printer" on a remote computer, thats why you only see the local printers.

    /Alexander

  • #20107
    Profile photo of Avi Arditi
    Avi Arditi
    Participant

    Hi Alexander,

    Thanks for your reply.
    I was wondering what is going on. 🙂

    ok is there away, if you can direct me the right way, to use the Get-printer for a specific user?

  • #20126
    Profile photo of deiandrei
    deiandrei
    Participant

    Well, one option would be to read the registry entries of the current user. The network printers are listed under HKCU\Printers\Connections

  • #20127
    Profile photo of Alexander Johansson
    Alexander Johansson
    Participant

    I suggest that you take a look at this thread:
    http://stackoverflow.com/questions/20639541/get-default-printer-remotely

    /Alexander

  • #20142
    Profile photo of Avi Arditi
    Avi Arditi
    Participant

    hi Deiandrel and Alexander

    again just a big thank you for taking the time and helping much appreciated.

    I saw a few version of this script that I wrote yesterday (at home I found that someone already wrote this and did a better job 🙂 )

    I am testing to see if this will delete the printers regarding of the user logged to the PC if this will work then I'll be very happy and will let you know.

    Function Delete-networkPrinters {

    $netprinters = Get-WmiObject -Class win32_Printer | where-object{$_.network}
    If ($netprinters -ne $null)

    {
    Foreach($netprinter in $netprinters)

    {
    $netprinter.Delete()
    Write-Host "the following printers were removed" + $netprinter.name
    }
    }

    Else{read-host "no printers found"}
    }

    Delete-networkPrinters

  • #20299
    Profile photo of Avi Arditi
    Avi Arditi
    Participant

    this scripts is now working well and its simple ( I am new to powershell and like simple :))

You must be logged in to reply to this topic.