List mapped printers for current logon user in Windows 7.

If you ever think of getting a list of mapped printers for current logon user, you might had Google for List mapped printer Windows 7.

I see some nice scripts from  Spicework and Technet, the Technet one will list mapped drives as well. The script is kind of lengthy and I do not bother to read and understand what it is doing, so I start to think of another simplier approach.

In Windows XP, we have some built-in scripts for printer management. For more information about this, you may want to visit Techrepublic.  Those scripts is still here with Windows 7, but at a different path, Techrepublic had another article about this.

To list printers of the current logon user, run the following in the command prompt:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -l

The result from the command will list out the mapped printers with some extra info, if all you need is the printer names, you may want to run the following instead:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -l|find /I "printer name"

If you want to list out the default printer only, run the following:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -g|find /I "default"

Some may want to redirect the output of the command to a text file like with username and computername as below:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -l|find /I "printer name" > c:\temp\%USERNAME%-%COMPUTERNAME%-Mapped_Printer.txt

Many would ask, how to run that script on a remote computer to get the list of mapped printers for the current logon user on that remote host. My approach is to run it with owexec from Office Warfare. To be able to use owexec to run a command as the current logon user, you will need to have local admin right for that remote host.

First, modify the script to redirect to an UNC path as it would be pointless to drop the result on that local machine.

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -l|find /I "printer name" > \\server\public$\printer\%USERNAME%-%COMPUTERNAME%-Mapped_Printer.txt

Next, put the script into a batch file (getmapprinter.bat) and run the following comand:

owexec.exe -c computername -k getmapprinter.bat -copy

You should be able to find the result at the path above.


One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s