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
203 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

This article will step through configuring a SonicWALL appliance to utilize an internal DHCP server for Global VPN Client (GVC) hosts.  There are times when using an external (external to the SonicWALL) DHCP server, such as Windows Servers, isn’t pr…
Learn about cloud computing and its benefits for small business owners.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 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