Login Script to map a printer in Windows Server 2003

I'm not a scripting guru so does anyone got a good login script to give domain users without admin rights a shared printer off the network? Use "server" and "share" in the code. Ex. \\server\share    Thanks a bunch!!!!
Kingjack36Asked:
Who is Participating?
 
FrontlavenConnect With a Mentor Commented:
What we do here is have the login script under AD as login.bat.

Make a new text file on your desktop and put the line

rundll32 printui.dll,PrintUIEntry /in /n "\\servername\printersharename" /q

into the text file then save it. Next rename the file from XXX.txt to login.bat

Then go to \\youradserver\netlogon

and move the login.bat into that location.

Now use that username to login to a machine...it should map.
0
 
FrontlavenCommented:
We have this going in my office.

rundll32 printui.dll,PrintUIEntry /in /n "\\servername\HP4050" /q
0
 
Kingjack36Author Commented:
awesome i will try that tommorrow. :)
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
FrontlavenCommented:
On the first google search you will find this site for the attributes in case you want to customize the script more.

http://www.robvanderwoude.com/2kprintcontrol.php
0
 
Kingjack36Author Commented:
I have tried it, doesnt seem to be working. How long does it take for it to show up in the Printers and Faxes folder? instantly upon login, or does it take 10min or so? I have typed the syntax in correctly im sure of it. Thanks!
0
 
FrontlavenCommented:
Let's try to diagnose this.

First let's try to map it manually.

Go to start>run

Type in \\servername

You should see the printer shared out if that was done properly from the server-end.

Now right click the printer and go to connect.

Now go to your Printers list and see if it appears. if it does not then there is a permission or driver issue.

If it does right click the printer and go to delete.

Now go into Start>run and put in the whole line spelled exactly the same way as how the server and printer are listed.

rundll32 printui.dll,PrintUIEntry /in /n "\\servername\printersharename" /q

Press enter.

Check to see if the printer got created.
0
 
FrontlavenCommented:
Oh yes and it happens immediately. If you have the printer list up when you do the run command it will immediately appear as a printer on your list.
0
 
Kingjack36Author Commented:
It works doing that way. The printer got created. I am putting that exact script into the "login script" box on the user profile in AD.
0
 
Kingjack36Author Commented:
Yes it appears immediately. Do i need to put a "run" function into the login script box? right now all i have in there is: rundll32 printui.dll,PrintUIEntry /in /n "\\servername\printersharename" /q
0
 
Kingjack36Author Commented:
I tried pasting it into the NETLOGON folder and it says access is denied. Any ideas?
0
 
FrontlavenCommented:
Log in as the domain admin on the domain controller then try it from there.

The real location from the DC is:

C:\WINDOWS\SYSVOL\sysvol\domainname.local\scripts
0
 
Kingjack36Author Commented:
Ok i got it pasted into the NETLOGON folder. Now will everyone who logs in the domain get that script run for them? Reason being I don't want the students to get this printer, only faculty. Will it only take effect if i put it in the login script box under profile in AD?
0
 
FrontlavenCommented:
It would only effect everyone if you made a group policy and applied it to "everyone".

The simplest way to isolate it is to insert login.bat into every faculty user's AD configuration. Eventually you might want to optimize the process by creating an OU (organizational Unit) called Faculty, dropping all faculty users into that OU, then creating a group policy that has this login.bat in place. Then it will apply this mapping to all users that are in the faculty OU.
0
 
Kingjack36Author Commented:
When you say facultly users AD configuration, you mean typing "login.bat" into the login script box right?
0
 
FrontlavenCommented:
Yes I mean going into Active directory users and computers>Finding a username>double-clicking that name>going into the profile tab>and inserting login.bat into the "login script box".
0
 
Kingjack36Author Commented:
Awesome works like a charm. Thanks so much for all your help!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.