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
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

#Citrix #Citrix Netscaler #HTTP Compression #Load Balance
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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