0phoi5 Posted December 8, 2015 Share Posted December 8, 2015 (edited) 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 directoryand 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 December 8, 2015 by haze1434 Quote Link to comment Share on other sites More sharing options...
cooper Posted December 8, 2015 Share Posted December 8, 2015 I would use a different approach for discovering the printers. See here. Quote Link to comment Share on other sites More sharing options...
0phoi5 Posted December 9, 2015 Author Share Posted December 9, 2015 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. Quote Link to comment Share on other sites More sharing options...
cooper Posted December 10, 2015 Share Posted December 10, 2015 See here. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.