4

I've been using "net use" successfully to connect to shared drives on my network with Windows 7. Now, I am trying to connect a Windows 7 computer to a shared printer on a windows 7.

So, on the client computer I've done through it the GUI to see everything works properly. Than, I disconnected the printer and tried using the command line to do the same thing like this:

net use \\FRONTPC\FCPrinter 

it says:

The command completed successfuly.

However I don't see the printer under "Devices and Printers". So, where is the printer? What am I doing wrong?

oz123
  • 1,198
  • 5
  • 16
  • 32

2 Answers2

4

From ss64:

"NET USE command can map a network printer to an LPT port (for DOS type applications that print to a port.) but this does not add the printer to the Control Panel GUI."


If you're limited to using cmd, you might want to use Rundll32 printui.dll,PrintUIEntry.

If you can use PowerShell, you can do something like this:

$prnt = [wmiclass]"Win32_Printer"
$prnt.AddPrinterConnection("\\PrintServer\PrintShare")

MDMarra
  • 100,183
  • 32
  • 195
  • 326
  • thanks, that looks useful, but I'm still not getting the awkward syntax of the printui.dll command... can you explain? – oz123 Dec 08 '11 at 20:29
  • 3
    Something like `RUNDLL32 PRINTUI.DLL,PrintUIEntry /ga /n\\PrintServer\PrintShare` should work. There's a good outline with examples [here](http://www.robvanderwoude.com/2kprintcontrol.php) – MDMarra Dec 08 '11 at 20:44
  • I managed to "add" the printer using powershell. However... The print test page fails ... And, I know it works using the gui... So there is still one more step missing...Maybe it's the driver ? – oz123 Dec 08 '11 at 20:56
  • @Oz123 I have that exact code in a larger script that successfully maps printers for hundreds of computers without issue. – MDMarra Dec 08 '11 at 20:58
  • I guess it is is a driver issue ... On another printer the return code was 0, so the printer did succeed with printing a test page. However with the faulty printer the error code was 1797... – oz123 Dec 08 '11 at 21:03
  • I believe you :-) However, I am a Linux admin, who's been thrown to the sharks. I have to admin windows now... and everything is new... How do I know what is a 1797 error??? – oz123 Dec 08 '11 at 21:04
  • @Oz123 A quick Google search shows that it usually occurs when the driver fails to install for some reason. If this allows you to map most printers, you should accept the answer. If you continue to have an issue with a specific printer, you should open a new detailed question that includes the method of mapping and any error logs that you find. As a new Windows admin, I think you'll enjoy PowerShell. It's the closest thing that we have to bash. – MDMarra Dec 08 '11 at 21:09
1

When you are using cmd - net use command you won't get Printer in your Devices and printers. This command is good for MS DOS based applications to print on LPT port even if your PC doesn't have any. Sometimes even you have installed USB printer you simply can't print through MS DOS apps and that is scenario where you use this way to map your Printer on a LPT port.

On this post I have explained how to use this command in Local Network with a PC running Win 7 and other running Win XP

IvanS
  • 11
  • 1