Get-Printer error on one specific server

Welcome Forums General PowerShell Q&A Get-Printer error on one specific server

This topic contains 1 reply, has 1 voice, and was last updated by

3 weeks, 2 days ago.

  • Author
  • #179973

    Topics: 1
    Replies: 1
    Points: 14
    Rank: Member

    My organization has a very strange problem. We have created various scripts to do certain tasks that are printer related. Tasks including deleting print jobs that have errors, changing drivers on printers, creating new printers, deleting unused printer ports, etc. All of these scripts use Get-Printer in some way. We have 3 print servers and use these scripts on all 3. The Get-Printer command works on 2 of the 3 servers. It used to work on the 3rd and I am not sure at what point things went bonkers. Let's call this broken server SERVER3.

    On the server it doesn't work on I can:


    And I get the following output:

    get-printer : A general error occurred that is not covered by a more specific error code.
    At line:1 char:1
    + get-printer
    + ~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (MSFT_Printer:ROOT/StandardCimv2/MSFT_Printer) [Get-Printer], CimException
    + FullyQualifiedErrorId : MI RESULT 1,Get-Printer

    If I use Get-Printer from the problem server to view printers on another server it works fine. Get-Printer from a remote server to the problem server does not work.

    This works from the problem server:

    Get-Printer -ComputerName SERVER2

    This gets the same error from a remote machine to the problem server:

    Get-Printer -ComputerName SERVER3

    I tried to remove and install RSAT-Print-Services to see if that repaired Get-Printer:

    Remove-WindowsFeature RSAT-Print-Services
    Install-WindowsFeature RSAT-Print-Services

    Get-Printer still returns the same error message after this process. So I decide to see if I can do the WMI query from the problem server using the below:

    Get-WmiObject MSFT_Printer -Namespace ROOT/StandardCimv2

    The WMI command returns exactly 1 printer then immediately after the last property 'PSComputerName' it returns the following error:

    Get-WmiObject : Generic failure
    At line:1 char:1
    + Get-WmiObject MSFT_Printer -Namespace ROOT/StandardCimv2
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

    This is my first time posting here but I am at my wits end. If this isn't the proper place to ask this question if someone could point me to a resource I could use it would be greatly appreciated. Most of our scripts I could edit them to use Get-CimInstance or Get-WmiObject instead but I am really trying to avoid that if possible. Just curious if anyone might have ran in to this before or have any ideas of what may be causing it. The funny thing is we built this server again from scratch because of this problem and it worked fine for a few months before once again coming to this point. I am wondering if it could possibly be an malformed or corrupt printer object that is causing the problem. I tried deleting the one that it returns and it just returned a different single printer before returning the error code.

    Any help woudl be much appreciated. Also hello!

  • #180144

    Topics: 1
    Replies: 1
    Points: 14
    Rank: Member

    I am just adding some additional info. The print server which has the problem is Server 2016 1607. Below is the powershell version information.

    PS C:\Windows\system32> $PSVersionTable
    Name Value
    ---- -----
    PSVersion 5.1.14393.3053
    PSEdition Desktop
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 10.0.14393.3053
    CLRVersion 4.0.30319.42000
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3

    Get-PrinterDriver and Get-PrinterPort both work as expected.

You must be logged in to reply to this topic.