Solved

How do I create a script for server 2003 to automatically install shared drives and printer when adding a new member to the Domain

Posted on 2009-04-03
4
199 Views
Last Modified: 2012-05-06
Hello,

First off I am a bit of a noob.  So please, please, please use lamen terms when typing your response.  I'm sure it will also help others who think about this.  I will also need a clear explanation of what I am doing and why... So I actually learn from this tread.  Lastly, I am quite busy.  So if I don't respond immediately please be patient with me.  I will respond.

OK....  I just installed a SBS Server 2003 into "my home"  for practice purposes...  Can you please explain to me "How to create a script so if I connect another XP pro machine or Vista Buisness/Ultimate and use my domain name."  The DC will automatically attach my shared folders and IP printer to the account.

Thanks in advance...
0
Comment
Question by:timarnold000
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
yegs2000 earned 500 total points
ID: 24061754
Ok,

So on the domain controller you will have to navigate to Start > Administrative Tools > Active Directory Users and Computers.

Then you can locate the particular user you want to create a "logon script" for and select properties of this user. When you are in properties there will be a tab that says "profile." In this tab will be a textbox that says "logon script." just type something like logon.bat or w/e name you want to give it, but it should be a .bat file.

Next navigate to your domain's sysvol scripts folder (this is where your domain specific scripts are kept [e.g. logon scripts]): For example for a domain test.com it would be located at:
 C:\Windows\SYSVOL\sysvol\test.com\scripts

In the scripts folder right click and create a new batch file (just make a text file and save it as logon.bat just keep it consistent with what you typed in the logon script text box).

Next right click on the logon.bat file and click edit. It should bring up an editable notepad. Then you can begin typing what drives you want mapped.

Let's say you want to map drive i: to a folder called 'share' located on server 10.1.100.30
net use i: \\10.1.100.30\share

If the share was password protected with a username of user and password of test1 the syntax would be the following:
net use i: \\10.1.100.30\share test1 /USER:user

So everytime the computer logs on, it will run the "net use" command which is just a DOS command to map drives.
--

Now if you want to map a printer I created a seperate file called printers.vbs that is located in the same directory as the logon.bat file. At the very end of my logon.bat file I have a line that says "printers.vbs" which runs the script to add printers.

I am not 100% sure how this one works, but it does a great job adding printers, it seems to get more into the nitty gritty of coding or scripting which does not necessarily interest me. Here is the code in the printers.vbs file that is used to connect to printers named hp5000 and hp6000 which are connected to a machine 'zeus.test.com' the last line of the code then sets the hp5000 to the default printer.

Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\zeus.test.com\hp5000"
objNetwork.AddWindowsPrinterConnection "\\zeus.test.com\hp6000"
objNetwork.SetDefaultPrinter "\\zeus.test.com\hp5000"


Hopefully this will help you out!
If you need anything else, just reply back!
0
 
LVL 3

Expert Comment

by:yegs2000
ID: 24061791
Just to clarify,

the way I do this for my organization is as follows:

In the scripts folder I have two files logon.bat and printers.vbs

The logon.bat file has all the shared drives using the "net use" commands listed above. The last line of this file then simply is
                                                   printers.vbs

This simply executes the .vbs file that has the code to connect the printers. If you need more clarification just let me know!

It's pretty cool though once you start doing this kind of stuff and getting into the in-depth server administration!

All the best!
-yegs
0
 
LVL 8

Expert Comment

by:MrMintanet
ID: 24064696
NET USE \\SERVERNAME\SHARE
^ That's to connect a drive using CMD

Only administrative accounts can use CMD to mount printers on the network.  I do this manually for each computer.  It's a two way street with letting a network user connect to your printer in this fashion.  One, he can add it.  Two, he can delete it.  Not good to delete printers from a server.  If you go to a server's root share point, delete the printer.  It would delete the printer's share point completely.  This would remove it from the network.
0
 

Author Closing Comment

by:timarnold000
ID: 31566159
VERY EASY TO UNDERSTAND AND IT WORKS!!!  Thanks yegs2000
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Do you have a computer or other electronic gear that is attached to a rat nest of cables, or alternatively have your cables all bundled nice at neat?  If so then read this post to sidstep common pitfalls. When I was a student at DeVry University,…
#Citrix #Citrix Netscaler #HTTP Compression #Load Balance
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now