List installed/mapped newtork printers in a PC for a user remotely

ryder0707 used Ask the Experts™
How do i list all the installed/mapped newtork printers in a specific PC for a domain user remotely? Assuming the user had logon to the PC before
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
it is stored in the users' profile. Open regedit and load hive NTUSER.DAT from user's profile directory. Then navigate to "Printers\Connections" where you can find the list of printer names including the print server name.
Top Expert 2009


Can i do it remotely? Is it possible to load hive while user is logon? Any impact to the user?

The user won't notice anything. If it's just to look there.
no, you cannot load or copy this file while the user is loggen on. However if you use roaming profiles, you can copy it from the server. If the user is logged on you can also get the printer information from the loaded user hive. Open regedit, connect to the remote PC and go to HKEY_USERS and select the right user account. It should be easy if you have the user's SID. If not, there should be only one key with a long SID name.

In the following page you will find some nice vbs scripts from Microsoft that work for local and remote computers. Just use them...
hi .. u can connect remotely to his registry via remote registry and check the following locations in his registry

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers\"your server"\Printers\your printer

HKEY_USERS\"SSID of user""S-1-5-21"""\Printers\Connections\,,your printer

HKEY_USERS\"SSID of user""\Printers\Settings

HKEY_USERS\"SSID of user"\Software\Microsoft\Windows NT\CurrentVersion\Devices

HKEY_USERS\SSID of user"\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts

The remote registry service must be enabled on his system
Ben Personick (Previously QCubed)Lead SaaS Infrastructure Engineer
I am posting this here as well as I believe this script solves your issue in both articles.  My script will connect to a remote computer, mount the hive of a user you specified, and output a list of all the printers in that user's registry.


* If the User is logged on this will not work, you will need to connect to the registry remotely instead, which can be accomplished with a minor change to my script.

* If a printer has been uninstalled from that user the printer will not appear on the list because it will not exist in the registry..

:: Script: FindRemotePrinter.Bat                                            				 	  ::
:: Version: 1.0                                                                                   ::
:: Copyright: Ben Personick                                                                       ::
:: Date: 2010-07-06                                                                               ::
::                                                                                                ::
::                                                                                                ::
:: Desc: This script Mounts a Registry Hive on a machine and parses the names of the printers	  ::
::																								  ::

:: This section sets up default variable settings and sets the logging directory and file name.   ::
	CALL :Start-Set-Date
	GOTO :End-Set-Date
		SET TDate=%date:~10,4%-%date:~4,2%-%date:~7,2%
		SET TTime=%Time:~0,2%.%Time:~3,2%.%Time:~6,2%
	SET Preamble=FindRemotePrinter --
	SET SrcUser=USERNAME_To_Find_Printers_Of
	SET SrcShare=C$\Documents And Settings
	SET PLog=%SrcComputer%_%SrcUser%_%TDATE%_%TTIME%.log
	SET IDir=c:\FindRemotePrinter\Log
	SET ILog=ILog_%TDate%_%TTime%.Log
		ECHO %Preamble% Checking For %IDir%
		IF EXIST %IDir% ECHO %Preamble% IDir "%IDir%" -- Found! -- GOTO End-Prep >> %IDir%\%ILog%
		ECHO %Preamble% Creating %IDir%
		mkdir %IDir%



	ECHO --------------------------------------------- >> %IDir%\%PLog%
	ECHO -- Computer: %SrcComputer%					-- >> %IDir%\%PLog%
	ECHO -- User: %SrcUser%							-- >> %IDir%\%PLog%
	ECHO -- Date: %TDate%							-- >> %IDir%\%PLog%
	ECHO -- Time: %TTime%							-- >> %IDir%\%PLog%
	ECHO --------------------------------------------- >> %IDir%\%PLog%
	ECHO. >> %IDir%\%PLog%
	ECHO --------------------------------------------- >> %IDir%\%PLog%
	ECHO -- The Following Printers Were Discovered:	-- >> %IDir%\%PLog%
	ECHO --------------------------------------------- >> %IDir%\%PLog%

		reg LOAD HKEY_USERS\%SrcUser% "\\%SrcComputer%\%SrcShare%\%SrcUser%\NTUSER.DAT"

		ECHO %Preamble% Start-Find-Printer --
		ECHO %Preamble% Start-Find-Printer -- >> %IDir%\%ILog%
		for /F %%A IN ('reg query HKEY_USERS\%SrcUser%\Printers\ /s') DO CALL :Start-Print-Loop %%A
		GOTO End-Find-Printer
			SET PTemp=%1
			IF ERRORLEVEL 1 GOTO Start-IS-Printer
			GOTO END-IS-Printer
				ECHO %PTemp% | FIND /I "Default"
				IF ERRORLEVEL 1 GOTO Start-IS-Printer
				GOTO END-IS-Printer

				ECHO %Preamble% The following Printer was Found - %PTemp% -- And Stored in %IDir%\%PLog% --
				ECHO %PTemp% >> %IDir%\%PLog%
				ECHO %Preamble% The following Printer was Found - %PTemp% -- And Stored in %IDir%\%PLog% -- >> %IDir%\%ILog%
	ECHO %Preamble% The Registry has no more entries at %LookupKey% --
	ECHO %Preamble% The Registry has no more entries at %LookupKey% -- >> %IDir%\%ILog%	


	CALL :Start-Set-Date
	ECHO %Preamble% The Batch File Completed ON %TDATE% AT %TTIME% --
	ECHO %Preamble% The Batch File Completed ON %TDATE% AT %TTIME% -- >> %IDir%\%ILog%

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial