Jump to content

[CMD/Batch] Add printer without using full printer name


haze1434
 Share

Recommended Posts

Hello all,

Sorry to ask another CMD/Batch question, I'm still learning and having way too much fun ;)

I'm trying to add a printer using...

rundll32.exe printui.dll,PrintUIEntry /in /n "\\servername\Printer Name"

... which works great IF you know the full name of the printer you are trying to add.

If I use Windows 7's Control Panel > Devices & Printers to add a printer, I can select;
Add A Printer > Add A Network Printer > The Printer I Want Isn't Listed > Find a printer in the directory
and then type in a small section of the printer's name and it will find it.

For example, one of our printers is called 'Q123 HP LJ MFP M880 on SERVERNAME' but I can find it by simply typing in Q123.

Is there a way that I can get the batch command to add the printer using something like...

rundll32.exe printui.dll,PrintUIEntry /in /n "Q123"

... and get the system to do the same kind of search it would do if I went through the control panel (automatically search our print server for a name like 'Q123' and install it?)

I have trawled the internet for a while looking for this info, but was unsuccessful in finding anything that didn't state to input the full name of the printer.

Thank you in advance.

*edit* Amended grammar/spelling.

Edited by haze1434
Link to comment
Share on other sites

Hi Cooper,

That would be perfect if it worked correctly.

Unfortunately, the output of...

get-WmiObject -class Win32_printer | ft name, systemName, shareName

...is...

name                                     systemName                   shareName                              
----                                     ----------                   ---------                              
Send To OneNote 2010                     [HOSTNAME]                                     
Microsoft XPS Document Writer            [HOSTNAME]                                           
Fax                                      [HOSTNAME]                                 

... which is wrong. There should be a few hundred printers on the network, but it only shows 3 local printers, nothing on the network at all.

If this could show all network printers, that would be amazing, as I could simply then pull the relevant line with the printer name 'Q123' from the output.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...