Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, August 8, 2013 7:59 AM
Hello all,
I am trying to remotely get printer information from domain joined user workstations through PowerShell, and I am having problems with some of them.
Environment info:
- Administrator workstation – Windows 8 Enterprise Edition
- User workstations – Windows 7 Enterprise Edition with SP1
- Domain controllers and domain functional level – Windows 2008 R2 Standard Edition
- User that PowerShell is run under has local administrative permissions on all user workstations
Command I am using is „get-printer –computername comp_name“. Some computers return printer list as expected, but some computers return following error:
get-printer : The spooler service is not reachable. Ensure the spooler service is running
.
At line:8 char:5
+ get-printer -computername ($item.name)|select computername,name,drivername,p ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* + CategoryInfo : NotSpecified: (MSFT_Printer:ROOT/StandardCimv2/MSFT_Printer*
* ) [Get-Printer], CimException*
* + FullyQualifiedErrorId : HRESULT 0x800706ba,Get-Printer*
WinRM and File and printer sharing exception are enabled on all user workstations and other PowerShell commands that use computername parameter are functioning (e.g. get-service –computername comp_name). Also, I can remotely query printer list on computers that have problems with get-printer cmdlet by using WMI within PowerShell (get-wmiobject win32_printer –computername comp_name)
I’ve compared services running on computers that have no problem and on computers that I have problem with, I’ve tried turning off the firewall, I’ve checked domain connectivity, but everything seems in place. Since I am out of ideas, I obviously need help.
Thanks, MiToZ
All replies (14)
Thursday, August 8, 2013 9:04 AM | 4 votes
Same question for you aswell, so this one is no actual help for you?
Get-WMIObject -Class Win32_Printer -Computer ($item.name) | Select Name,DriverName,PortName,Shared,ShareName | ft -auto
I've seen you used it already but I'm a little bit confused of how you used it and if this one is any help to you.
The following is my signature:
Powershell Programmer & Advanced Lua Programmer
Location: Switzerland
Beside that, whenever you see a reply, you think is helpful, click "Vote As Helpful"! And whenever you see a reply being an answer to the main question of the thread, click "
Mark As Answer" (if you opened the thread).
I published the URL's for the icons in my signature.
Please contact me, before reporting me, thank you.
Need any links for images like CodeBlock? Go here.
Thursday, August 8, 2013 9:46 AM
All WMI commands ran through PowerShell work without problem, including the one that you sent. I am still puzzled why I have problem with Get-printer cmdlet ... as far as I am aware -computername parameter in get-printer uses RPC, and get-wmiobject is querying WMI directly ... what I am mostly confused about is that other RPC based PowerShell commands work without a problem.
Thanks, MiToZ
Thursday, August 8, 2013 1:25 PM
i think get-printer cmdlet is for 2012 or win8 devices, therefore your win 7 doesnt know what you are requesting..
Thursday, August 8, 2013 1:29 PM
Hello ImMax,
Maybe I was not clear enough in my first post, but I have hundreds of Windows 7 SP1 workstations that are successfully answering get-printer query ...
Thanks, MiToZ
Thursday, August 8, 2013 6:21 PM
Hello,
It seems like I've made some progress, but I would like to verify my findings ...
Here are two excerpts from Network Monitor trace. First one (two frames) is from Windows 7 SP1 workstation that has no problems, and second one (two frames) is from Windows 7 SP1 workstation that has problems.
Windows 7 SP1 workstations without problem ...
479 17:58:02 8.8.2013. 13.1003202 spoolsv.exe ADMINWKS USERWKSWORKING EPM EPM:Request: ept_map: NDR, IRemoteWinspool(PAR) {76F03F96-CDFD-44FC-A22C-64950A001209} v1.0, RPC v5, 0.0.0.0:135 (0x87) [DCE endpoint resolution(135)] {MSRPC:27, TCP:26, IPv4:25}
480 17:58:02 8.8.2013. 13.1007106 spoolsv.exe USERWKSWORKING ADMINWKS EPM EPM:Response: ept_map: NDR, IRemoteWinspool(PAR) {76F03F96-CDFD-44FC-A22C-64950A001209} v1.0, RPC v5, 10.10.10.10:49157 (0xC005) [49157] {MSRPC:27, TCP:26, IPv4:25}
Windows 7 SP1 workstation with problem ...
7126 18:00:17 8.8.2013. 148.0566875 spoolsv.exe ADMINWKS USERWKSPROBLEM EPM EPM:Request: ept_map: NDR, IRemoteWinspool(PAR) {76F03F96-CDFD-44FC-A22C-64950A001209} v1.0, RPC v5, 0.0.0.0:135 (0x87) [DCE endpoint resolution(135)] {MSRPC:124, TCP:123, IPv4:122}
7127 18:00:17 8.8.2013. 148.0570386 spoolsv.exe USERWKSPROBLEM ADMINWKS EPM EPM:Response: ept_map: 0x16C9A0D6 - EP_S_NOT_REGISTERED {MSRPC:124, TCP:123, IPv4:122}
It seemed to me that spoolsv was not registering itself with RPC Endpoint Mapper and subsequently couldn't be contacted from ADMINWKS, so I decided to make sure that it tries to register itself. To do that, I've decided to share one of defined printers on USERWKSPROBLEM. After doing that, I am now able to remotely access USERWKSPROBLEM printer list using PowerShell get-printer cmdlet. Surely enough, all Windows 7 SP1 workstations that I have problem with have no shared printers and all Windows 7 SP1 workstations that have shared printer work without problems. I don't know if this is expected behavior with Windows 7, but I'll try to check it tomorrow with Windows 8 (with no shared printers) on both sides. If I find no other solution, I'll use get-wmiobject with win32_printer and computername parameter ...
Any opinions or verification of this behavior is welcome :)
Thanks, MiToZ
Monday, August 12, 2013 12:14 PM
Hi,
Any update about the issue? Does it work when use get-wmiobject?
In addition, this issue should be related with printers, please also post in the printer forum for more analysis.
Regards,
Yan Li
If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.
Cataleya Li
TechNet Community Support
Monday, August 12, 2013 12:19 PM
Hello Yan Li,
As I said in the first post, get-wmiobject -computername name_of_computer win32_printer works both on workstations that have problems and those that have no problems with get-printer cmdlet.
Thanks, MS
Friday, August 16, 2013 12:02 PM
Hi,
Can you run the below command line to check whether you get the detailed printer information from the affected client:
PS C:\ Get-Printer –Name "Microsoft XPS Document Writer"
Note :You can replace Microsoft XPS Document Writer with specific printer on the one of the affected clients.
For more information, check the below links:
http://technet.microsoft.com/en-us/library/hh918358.aspx
http://technet.microsoft.com/en-us/library/ee176860.aspx
Thanks,
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Friday, August 30, 2013 8:44 AM | 1 vote
Hello Leo Wang,
As far as I know, get-printer command is not available on Windows 7 SP1 by default. Please re-read my question, and as for marking something as answer, please let the thread creator do it.
Thanks, MS
Friday, September 6, 2013 8:21 PM
Hi Mitoz
I came across the same issue this morning. You're correct - the <Get-PrinterDriver> command is only available with Win8/Server2012.
The reason you get a response from some hosts and not others is because the spooler service on the remote host isn't configured to support Print System Asynchronous Remote Protocol (MS-PAR). If the remote spooler service doesn't have MS-PAR enabled, it won't create a listening port or register with RPC and the cmdlet will return that exception.
In your Network Monitor capture, you'll see the RPC end point mapper (EPM) request from your local machine to the remote spooler endpoint (IRemoteWinspool) and the differenct response from hosts with MS-PAR enabled and disabled.
You can check a host by having looking for <\.\pipe\spoolss> in the open pipe handles list locally:
[System.IO.Directory]::GetFiles("\\.\\pipe\\") | Select-String -pattern '\\spoolss'
You can query a remote host by testing a connection to the named pipe:
$PipeName = "spoolss"
$ComputerName = "SERVER1337"
$ConnectTimeout = 5000
$StreamObject = New-Object -TypeName System.IO.Pipes.NamedPipeClientStream -ArgumentList $ComputerName,$PipeName,([System.IO.Pipes.PipeDirection]::InOut), ([System.IO.Pipes.PipeOptions]::Asynchronous),([System.Security.Principal.TokenImpersonationLevel]::Impersonation)
Try
{
$StreamObject.Connect($ConnectTimeout)
}
Catch
{
Write-Warning ("[{0}]: Failed to connect to named pipe: <{1}>" -f $ComputerName, $pipeName)
}
More info here: http://msdn.microsoft.com/en-us/library/hh441961.aspx
RMCK
Thursday, October 16, 2014 11:25 PM
Do you know how it gets enabled? I have several Server 2003 machines I'm trying to get the information from. Of the 72, only 9 don't have this enabled. I saw on http://msdn.microsoft.com/en-us/library/hh455083.aspx in the section labeled "<11> Section 3.1:" that it can be enabled/disabled via registry setting, but it doesn't articulate which key, or what setting.
Friday, October 17, 2014 7:37 PM
Hello Polonius19,
In the end, I think I did what I wrote in one of my previous replies. I temporary shared printers (to force registration with EPM), got info that I need, and removed printers that I wanted removed. I am sorry I am not of more help, I completely forgot this even happened. Richard McKenzie, in case I haven't thanked you in some way before, thank you for your answer.
MiToZ
Tuesday, November 18, 2014 11:40 PM
This thread was really helpful to me also. I was trying to manage a server with many print queues with the windows "print management" tool. None of the queues are shared, since they are all used only locally. It had the red down arrow in the print management tool, and indicated something to the effect that it was unreachable. I shared one printer, and I was able to use the tool to manage the printers after that.
thanks much.
bosco
Wednesday, January 21, 2015 12:40 AM | 2 votes
So I had this same issue come up today, and set about looking for the fix (again) ... came across this thread (again) and started reading through the replies ... I got to my post i started thinking "yes!! this is exactly the problem .. this guy has the same issue!" ... heh heh. Anyhow, I found a resolution ... this is the error I was getting when running Get-PrinterDriver from another machine:
Get-PrinterDriver : The spooler service is not reachable. Ensure the spooler service is running. At line:1 char:1 + Get-PrinterDriver -ComputerName SERVER01 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (MSFT_PrinterDriver:ROOT/StandardCimv2/MSFT_PrinterDriver) [Get-PrinterDriver], CimException + FullyQualifiedErrorId : HRESULT 0x800706ba,Get-PrinterDriver
The spooler was running just fine ... along with RPC, WinRM and every other core service.
[0120-15:52:18] RMCK R:\ps>Get-Service -Name spooler -ComputerName SERVER01
Status Name DisplayName
Running spooler Print Spooler
So the solution ended up being pretty simple - I ran procmon and restarted the spooler to focus on the startup behavior and caught it looking for a reg key that didn't exist: RegisterSpoolerRemoteRpcEndPoint (not found).
This thread confirmed the expected behavior for that key and after setting the value and restarting the spooler, all was good.
[System.IO.Directory]::GetFiles("\\.\\pipe\\") | Select-String -pattern '\\spoolss'
New-ItemProperty -Path 'REGISTRY::HKLM\Software\Policies\Microsoft\Windows NT\Printers' -Name RegisterSpoolerRemoteRpcEndPoint -PropertyType DWORD -Value 1 -Verbose
Restart-Service -Name Spooler -Verbose
[System.IO.Directory]::GetFiles("\\.\\pipe\\") | Select-String -pattern '\\spoolss'
(images will prob be small ... might have to view image in another tab to see full size)
Get-PrinterDriver could be run against this server just fine after restarting the spooler.
I'm convinced the spooler service failed endpoint registration on this server when it starts because of registry print key bloat. The local print event log <Microsoft-Windows-PrintService/Operational> showed a huge list of eventID 304 "Resuming Printer" entries after the service started - despite a completely empty server - no users logged in (or disconnected), no one connected remotely, no local printers installed, and no network mapped printers. So what printers was it "resuming" ?? Here's the event details:
Printer {FFAFC337-3009-44C5-8EFD-1B9C38244649} was resumed. No user action is required.
A registry search for "{FFAFC337-3009-44C5-8EFD-1B9C38244649}" turned up another source of keys-run-wild (to the tune of thousands) that I've added to my already-long-list of keys that bloat (despite every applicable MS hotfix) :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider\Servers\PrintServer01\Monitors\Client Side Port\FFAFC337-3009-44C5-8EFD-1B9C38244649}
Each key had a matching entry (with subkeys) in the printers key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider\Servers\PrintServer01\Printers\FFAFC337-3009-44C5-8EFD-1B9C38244649}
I haven't tried removing those keys and then restarting the spooler to see if the service registers the the RpcEnpointMapper automatically (ie. without adding the value) but suspect it would be fine.
Anyhow, hope this saves someone else a lot of time - because there's just not much info on troubleshooting issues like this in high-volume RDS environments ... and I hope I can find this if I forget what I wrote here again ...
RMCK