List installed print server printers from a remote station

Asked

Viewed 2,444 times

0

I work in a company that has the following structure:

Each city of my state has a headquarters with a server that is also print server, in it are the printers of this headquarters.

I use the psexec of Systernals in conjunction with a command to install the printers, as shown below:

psexec \\172.20.19.218 cmd /c rundll32 printui.dll,PrintUIEntry /ga /n\\SRV-1112\PRT-2181
psexec \\172.20.19.218 cmd /c start /wait sc stop spooler
psexec \\172.20.19.218 cmd /c start /wait sc start spooler

However many times, before performing the installation, I would like to know if the printer is already installed on the user’s station, without having to contact it and access it remotely via vnc. But the commands I have never show these printers, only the virtual printers of Windows and other programs, as in the example below:

PS C:\Users\paulogoncalves> wmic /node:172.20.19.218 printer list status
Name                           Status
TASKalfa 3050ci                Degraded
Send To OneNote 2016
PDFCreator                     Unknown
Microsoft XPS Document Writer  Unknown
Microsoft Print to PDF         Unknown
Fax                            Unknown
doPDF 8                        Unknown

Note that the SRV-1112 PRT-2181 printer is not listed. Now, if I perform this query on my local station, the printers appear:

PS C:\Users\paulogoncalves> wmic printer list status
Name                           Status
Send To OneNote 2016           Unknown
PDFCreator                     Unknown
Microsoft XPS Document Writer  Unknown
Microsoft Print to PDF         Unknown
Fax                            Unknown
doPDF 8                        Unknown
\\srv-1378\PRT-1000            Unknown
\\srv-1419\PRT-1061            Unknown
\\172.20.16.40\PRT-2181        Unknown

The question is: Is there any command that performs the listing, including, of remote printers (this can be in powershell, vbscript or bat) or is this a network lock that prevents the display?

1 answer

1


In fact, what you do is you map a network printer to the user profile. This is not really an installation. We call this capturing the printer queue provided on server.

What you want is to know which printer queues exist for a particular user, probably the user who is in session at the station.

I can’t believe it’s a network jam. The "WMIC" command, and I believe other commands, will only return the printers in the machine context, and not from a specific user.

A possible solution would be to remotely open a specific user registration path.

$Credencial = Get-Credential
New-PSSession -Credential $Credencial -ComputerName $ComputadorRemoto |
    Enter-PSSession
$Resultado = Get-ChildItem -Path 'Registry::\HKey_Users\*\Printers\Connections' -ErrorAction 'Ignore'
#   Tratar $Resultado
Exit

Browser other questions tagged

You are not signed in. Login or sign up in order to post.