Link to home
Start Free TrialLog in
Avatar of rdabate
rdabate

asked on

Help! Can I map to a network printer using the Netlogon.bat??

Hi,

I need users to have there network printers when they move from one pc to another.  They are on a 2003 domain all xp workstations.  Can I have this done with the netlogon.bat?

Rick
Avatar of rdabate
rdabate

ASKER

If I use a vbs script to do this, doesn anyone know how to set it up within the Netlogon Folder?  It's new to me.  If I do it that way, below is what I found for commands for the printers.  I still need to network dirves mapped as well.  

Set objWSHNetwork = CreateObject("WScript.Network")  'create network object
strConnectString = "\\jc01\Cheshire - HP LaserJet 4000"
strConnectString = "\\Jc01\Cheshire - Toshiba eStudio 160"
strConnectString = "\\\\JC01\Cheshire-Brother MFC-420CN"
strResult = objWSHNetwork.AddWindowsPrinterConnection(strConnectString)

I've never done this before, only used the standard netlogon.bat to map drives. Can anyone help
If a script is the way you want to do it, you could save the vbs script in the netlogon folder (i.e. addprinters.vbs), then call the VBS from the netlogon.bat by putting the following line in the netlogon.bat:

\\domaincontrollername\netlogon\addprinters.vbs

For the record, make sure you call the AddWindowsPrinterConnection method after EACH printer connect string declaration.  So your vbs script would actually look like this:

'addprinters.vbs - connect common network printers
Set objWSHNetwork = CreateObject("WScript.Network")  'create network object
strConnectString = "\\jc01\Cheshire - HP LaserJet 4000"
strResult = objWSHNetwork.AddWindowsPrinterConnection(strConnectString)
strConnectString = "\\Jc01\Cheshire - Toshiba eStudio 160"
strResult = objWSHNetwork.AddWindowsPrinterConnection(strConnectString)
strConnectString = "\\JC01\Cheshire-Brother MFC-420CN"
strResult = objWSHNetwork.AddWindowsPrinterConnection(strConnectString)
Set objWSHNetwork = Nothing

And your batch file would have this line:

\\domaincontrollername\netlogon\addprinters.vbs

Where you supply, obviously, the correct domain controller and full path to where you placed the VBS script.

Hope this helps.

ASKER CERTIFIED SOLUTION
Avatar of RPPreacher
RPPreacher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial