?
Solved

logon scrips for printers and netowrk drives in windows 2003 server

Posted on 2007-10-20
24
Medium Priority
?
1,213 Views
Last Modified: 2008-10-25
I need use a logon scrip to  install 4 network pritners and map some network drives. Currently, We are running a .bat file to map the network drives, but not we have to install the network printer at each workstation. The printers are all on the same server. Also, we have the name of the .bat file in the account profile setting of each user in AD. But , we like to use GPO if possible. If to hard we can just put the scrip name in each user profile in AD. I like the patch file becuse its simple to do wiht the maped drives , but not sure if we can use it with printers too.
0
Comment
Question by:netcomp
  • 10
  • 5
  • 3
  • +3
23 Comments
 
LVL 3

Expert Comment

by:elissaqp
ID: 20116115
this is a simple script to add a network printer:

Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\PrintServer1\Xerox300"
WshNetwork.SetDefaultPrinter "\\PrintServer1\Xerox300"
0
 
LVL 70

Expert Comment

by:KCTS
ID: 20116128
There are some good examples of scripts that you can use with a GPO to map drives printers and other useful functions at http://www.computerperformance.co.uk/Logon/logon_scripts.htm.
0
 
LVL 85

Expert Comment

by:oBdA
ID: 20116147
You can map printers in a batch logon script as well using con2prt.exe (part of the NT4 Zero Administration Kit, but still works fine on XP).
Just put it into the netlogon share next to the logon script:

con2prt.exe /c \\PrintServer\Printer02

How to Use Con2prt.exe to Connect to a Network Printer
http://support.microsoft.com/?kbid=181663

Zero Administration Kit
http://download.microsoft.com/download/2/6/0/260afc88-2253-45f8-9781-546cff07edd9/zak.exe
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 5

Accepted Solution

by:
bkellyboulderit earned 1200 total points
ID: 20116253
Actual working example on 2003 with con2print (you need to download) as mentioned above:

net use t: \\server2\shared
net use s: \\server2\AccessFiles

:Accounting

ifmember Accounting
if not errorlevel 1 goto next
echo Connecting to Accounting...
net use y: \\server01\Acctg
con2prt /c \\server01\hpiv

:next

:mas90

ifmember mas90
if not errorlevel 1 goto next2
echo Connecting to Accounting...
net use y: \\server01\Acctg

:next2

con2prt /c \\server01\HP8100_2
con2prt /c \\server01\HP8100_3
0
 
LVL 1

Author Comment

by:netcomp
ID: 20116265
It would realy help if you could give me clear instruction on how to creat the scrip for bothy printe rand alos the netowrk drives and then how to use group policy or  any othe way to get it to the users when they login. Please read all of the qeustion above. Thaks for all of your help
0
 
LVL 1

Author Comment

by:netcomp
ID: 20116271
bkellyboulderitDate, Thanks for the info.
Now , how do I save the scrip that you provided. Do I put it in notepad and save it as a batch file. ? How do I get it to everyone in the domain.
0
 
LVL 70

Assisted Solution

by:KCTS
KCTS earned 400 total points
ID: 20116273
To use a group policy to apply the script you need to specify the script as a logon script. There are step-by-step instructions on how to do this at http://www.jsifaq.com/SF/Tips/Tip.aspx?id=8215 or http://isweb2.memphis.edu/umad/documents/LogonScript.htm

The previous link I gave you has good examples of the scripts themselves http://www.computerperformance.co.uk/Logon/logon_scripts.htm
0
 
LVL 1

Author Comment

by:netcomp
ID: 20116276
"Just put it into the netlogon share next to the logon script":?
what does that mean. Do I make fiel and put it next to our .bat file in sysvol
0
 
LVL 6

Assisted Solution

by:Ahmed Abdel Salam
Ahmed Abdel Salam earned 400 total points
ID: 20116729
1- open notepad, copy and past the following lines to create the script
@@Echo On
rundll32 printui.dll,PrintUIEntry /ga /n\\servername\printer share name
@Echo off
2- change the server name and printer share name as your network
3- save the file as .bat file
4- in active directory create a new OU, move computer or users you want them to have this printer connected to this OU
Note: you can share this printer for all user on this workstation if you make it as a startup script.
you can make this printer available for specific user whenever he is login in any workstation if you make it as login script
5- right click this OU, properties, group policy, add, create a new group policy
6- under computer configuration or user configuration go to windows settings, scripts (login or startup depend on your requirments)
press add and add this script you have created and shared.
refresh the policy from run gpupdate /force
HTH
0
 
LVL 1

Author Comment

by:netcomp
ID: 20116967
Ok X-reagent,
The above look great. How do I do it for more than one printer and also , what I do about our existing Maped Netowrk drives. Do I another scrip for that or can i put it all in one scrip
0
 
LVL 6

Expert Comment

by:Ahmed Abdel Salam
ID: 20116997
to add more than a printer you just need to duplicate this line with differnet printers names or if you would like to make each group of users / computers share one printer then you have to devide your computers / users to more than one OU and add a separate group policy for each OU and add this script after changing the printer name.
you can add it to the current netwrok share script but better to make a separate script for printer
0
 
LVL 85

Expert Comment

by:oBdA
ID: 20117617
I actually read your question; you said you already had a batch logon script in place that is currently mapping network drives.
That script obviously needs to be edited, and the lines to map the network printers using con2prt.exe have to be added.
Since con2prt.exe isn't a preinstalled standard tool, and you probably don't want to distribute it on on your clients, you can just put it into the netlogon share (the sysvol\scripts folder) right next to the logon script.
The line
con2prt.exe /c \\PrintServer\SomePrinter
will */c*onnect to the print server *\\PrintServer* and map the printer *SomePrinter* for the current user.
To connect four network printers, you'll obviously need four of those lines, with the correct print server and printer share name configured.
0
 
LVL 5

Expert Comment

by:bkellyboulderit
ID: 20117940
Yes, place the text I provided in your existing file.
Edit accordingly.
So, to elaborate on obda's comment,

1 - download con2print from download site
2 - put it in the netlogon directory on your Domain Controller.
3 - Edit the one script you have to include your mapped drives and your mapped printers, like what I provided. Include new lines for each additional printer or mapped drive letter, like in the example. Notice you can map these by groups if you desire.

You do not have to redistribute anything, just place the files in your Netlogon and include the script name in their profile settings.

Simple and works very well.  
BTW, you can multi-select user names names in the AD (CTRL key) and just put the script name in once, and all the users will update to that script.
0
 
LVL 1

Author Comment

by:netcomp
ID: 20119145
Where do I download the Con2prt.exe file. The link is for the Zero admin kit.
0
 
LVL 85

Expert Comment

by:oBdA
ID: 20119318
As I said: con2prt.exe is a *part* of the NT4 Zero Administration Kit. Either run the exe, which will extract the files, or open it in your favorite zip program and extract it like that.
0
 
LVL 1

Author Comment

by:netcomp
ID: 20119659
Ok the dirves map on the workstation , but he printers don't connect. When I click on the scrip on the server itself, the drives man and the printers also connect. I did put the con2prt.exe in the scripts folder next to the script.
I pused the script and noticed that when it gets to the printers , I get the following error:

con2prt.exe is not a recognized as an internal command.

0
 
LVL 1

Author Comment

by:netcomp
ID: 20119799
When we copy and past the con2prt.exe int the system 32 folder of each windows XP compuer the scrip works with the pritners, but we can't go to each computer and do that. What should we do . Thank you for your help
0
 
LVL 5

Expert Comment

by:bkellyboulderit
ID: 20119838
OK. There are two files in the zero admin kit you also need in the netlogon share. I forgot about this! Ack, sorry:    prnadmin.dll and prnmgr.vbs
0
 
LVL 1

Author Comment

by:netcomp
ID: 20119868
ok , where are these files. Do i need to pu them in sysvol. I  can't find them in the zero admin things.  
0
 
LVL 1

Author Comment

by:netcomp
ID: 20119877
I am stil at work . I would realy apricate you help
0
 
LVL 5

Expert Comment

by:bkellyboulderit
ID: 20119922
They should already be in program files directory where you installed the resource kit tools. Copy them to the netlogon share on your domain controller like you did with con2print.
0
 
LVL 1

Author Comment

by:netcomp
ID: 20120144
Ok I have windows 2003resource kit tools on the server and I copied the files to Sysvol, but it still does not work.
0
 
LVL 5

Expert Comment

by:bkellyboulderit
ID: 20123304
Any further luck since last night? Are you logging in and out to test this or just double clicking the logon.bat?  Try logging out and in to test.

This should work fine. If not, I'm a little confused here. I am using this myself. Hmmm.....
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question