Jump to content

How automate network printer logon?


Recommended Posts

Hi:

For some reason this simple task has eluded me. Toward the end of the unattended install (from boot CD), the now-installed network printer has a dialog box asking for the user name and password to access the printer. There's nothing (that I saw) in setupmgr.exe that handles this, and printui.dll doesn't have an option to provide this (that I saw). I suppose I have to invoke 'net use' <something> to get this done.

Any help with this would be appreciated.

-- Roy Zider

Link to comment
Share on other sites


Only thing I can think of is to run a batch file with net use \\server\ipc$ /user:domain\user password and then execute a vbscript like the following:

WSHNetwork.AddWindowsPrinterConnection "\\Server\Printer"
Dim objPrinter
Set objPrinter = CreateObject("WScript.Network")
objPrinter.SetDefaultPrinter "\\Server\Printer"

But you may want to check your printer permissions to make sure they're applied properly, it shouldn't be prompting you for credentials.

Edited by Appleton
Link to comment
Share on other sites

I've been working with a simple command, which when the workstation is connected to the workgroup does connect me to the network printer:

start /wait net use \\MPX\HPLaserJ /user:Administrator <password>

This is an unattended install, and what has been the problem is that Windows XP has no default driver for the Nvidia motherboard Ethernet controller I'm probing for the right place to install the NIC drivers with devcon.exe in the winnt.sif, but haven't found it just yet. I'm thinking that if I can get the NIC drivers picked up early enough, the pnp enumeration will have the drivers to work with when it hits the hardware id of the controller chip. At the moment it just installs a null driver because it finds no compatible drivers to load.

Your suggestion of net use \\server\ipc$ /user:domain\user password may be necessary in any case, if the winnt.sif isn't handling the workgroup logon properly.

Link to comment
Share on other sites

It is prompting you because you are trying to connect to a network printer before your computer is logged into the network. You might be able to get around it by using a runas or net use command as suggested. When you are installing the printer you are a local admin. You then add the printer but it needs credentials to access it.

Edited by cyberpyr8
Link to comment
Share on other sites

It is prompting you because you are trying to connect to a network printer before your computer is logged into the network. You might be able to get around it by using a runas or net use command as suggested. When you are installing the printer you are a local admin. You then add the printer but it needs credentials to access it.

Yes, I realize that. The simple net use example I posted earlier seems to handle this logon in one command line, but I need to experiment with this some more.

Do you happen to actually have a 'net use' set of commands that will accomplish this logon to network and add printer? Otherwise I'll use the earlier post logging onto ipc$ etc.

Link to comment
Share on other sites

Actually what I ended up doing was creating a web page with links to printername.lnk shortcuts that I had for each printer. When I launched the page it will install one printer or a group if needed. I have the install place the web page shortcut on the all users desktop and that way the machine can be configured for the specific departmental needs of the user. I can be sure to run it before I deploy to the user and the PC is already on the network.

Link to comment
Share on other sites

That's pretty advanced for me, and for what I'm trying to do. This is an unattended install, so any interaction is what I'm trying to avoid.

At the moment, even though the "net use" command shows the \\MPX\HPLaserJ printer on the server, I still can't connect to it in the GUI with the Add Printer dialog box because the net use \\MPX\ipc$ command didn't connect me to the workgroup.

Still working through this problem, which is actually becoming more diffuse rather than more clear. It would help if there were some scripts around that ran through diagnostic tests to establish/eliminate some of these problems. The descriptions I've read so far are not very helpful.

Link to comment
Share on other sites

I'll assume the print server \\MPX is in a workgroup and that the printer is shared from there since it seems to be causing all this trouble. You need to connect/authenticate to \\MPX with an account on \\MPX not an account on one of your local systems. So if you had an account, say MPX\2Print (it doesn't have to be an adminstrator account), then just add an entry to HKLM\Software\Microsoft\Windows\CurrentVersion\Run with your net use command to \\MPX\ipc$, or just the printer \\MPX\HPLaserJ (e.g. net use \\MPX\ipc$ /user:MPX\2Print <password>). That should run at every boot and establish a connection to the print server.

If MPX is actually a server I'd recommend setting up a domain, tasks like this are so much easier with a common group of accounts and if you're tackling unattended installs it's not that far of a stretch and would make some of those tasks easier also.

Link to comment
Share on other sites

I'll assume the print server \\MPX is in a workgroup and that the printer is shared from there since it seems to be causing all this trouble. You need to connect/authenticate to \\MPX with an account on \\MPX not an account on one of your local systems.

Correct. I've used net use \\mpx\hplaserj /user:administrator <password> and it logs onto the resource OK (I assume -- it doesn't object).

So if you had an account, say MPX\2Print (it doesn't have to be an adminstrator account), then just add an entry to HKLM\Software\Microsoft\Windows\CurrentVersion\Run with your net use command to \\MPX\ipc$, or just the printer \\MPX\HPLaserJ (e.g. net use \\MPX\ipc$ /user:MPX\2Print <password>). That should run at every boot and establish a connection to the print server.

The problem here for me arises in the context of an unattended install. I've just gotten the NIC drives installed, but the winnt.sif isn't executing the networking directives. So I wanted to force group membership change from WORKGROUP to FUBARINSFO (the local workgroup) The details of all this unattended install are too complicated for this post. I just wanted to know the net use/view commands to log onto the local workgroup and onto the server. If you have a resource that I could review that would be helpful. I don't want to drag you through all the details of tutoring me on this subject.

Even after this when I try 'net view' I get a 'system error 6118' 'The list of servers for this workgroup is not currently available'. This is a pretty expected result, I would think -- it's just that at this stage I don't know how to go about fixing it.

If MPX is actually a server I'd recommend setting up a domain, tasks like this are so much easier with a common group of accounts and if you're tackling unattended installs it's not that far of a stretch and would make some of those tasks easier also.

Yes, that I will do eventually. I'm migrating over to a full server, but want to understand the workgroup lowlevel interactions first - which I'm obviously having trouble doing.

Thank you for your time.

Link to comment
Share on other sites

  • 1 year later...

I know this is an old topic, but my info is pertinent to this thread.

If you want to network printers and share files/folders in XP Pro without needing passworded accounts on the host machines, do either of the following:

Regedit method:

;Group Policy - Limit local account use of blank passwords to console logon only
;Essential for file/printer sharing without needing passworded accounts on host machines
;0 = disabled
;1 = enabled
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa]
"limitblankpassworduse"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"limitblankpassworduse"=dword:00000000

Group Policy editor method:

Start > run > gpedit.msc > Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options > Accounts: Limit local account use of blank passwords to console logon only (set this to disabled on all host machines).

Both methods are the exact same.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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