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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 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

16 Experts available now in Live!

Get 1:1 Help Now