• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

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

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
timarnold000
Asked:
timarnold000
  • 2
1 Solution
 
yegs2000Commented:
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
 
yegs2000Commented:
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
 
MrMintanetCommented:
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
 
timarnold000Author Commented:
VERY EASY TO UNDERSTAND AND IT WORKS!!!  Thanks yegs2000
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now