Home > Networking Tips > Network Engineering > Windows network and logon scripts
Networking Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

NETWORK ENGINEERING

Windows network and logon scripts


Barrie Sosinsky
04.30.2001
Rating: -3.60- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Windows network and logon scripts
Barrie Sosinsky

Whenever your users or members of a workgroup logs onto their workstations connected to a Windows domain, their options can be initialized in the user environment with logon scripts. You create the scripts with a text editor, and you must save them in specific directories depending upon whether us are using Windows NT 4.0 server or Windows 2000 Server. If you are using Windows NT, you should save the logon script on a primary domain controller in the winntsystem32replimportscripts. If you use Windows 2000, you must save the script on any domain controller in the directory winntsysvoldomainscripts.

Logon scripts can use Windows environmental variables. They can call other scripts or executable programs. They can also map network drives, initialize various options, or start background processes. If you are unfamiliar with logon scripts, check out Simplifying network options through logon scripts on the Microsoft Technet site.

If you are using Windows 2000 you will find information in the Server Documentation help files. A simple example of a logon script is one that maps network drive, network printers, and synchronizes the users' workstations with time servers. Try the following example from a command prompt:

		Net use y: reliantdata
		Net use LPT1: reliantprinter1
		Net time reliant /set/yes
This example maps drive Y: on the local machine to a network share called data on the main server, RELIANT. There is also a map to printer 1` to LPT1 on the local PC. The time setting is synchronized on the PC with the timeserver, also RELIANT.

When you have tasks that need to be done by some users and not others you can address that by using conditional statements. You can run specific commands for a user or group. The following examples also entered from the command prompt demonstrate this:

	If %USERNAME%=Administrator net use z: reliantadmtools
	If ifmember.exe "HR" net use t: relianthr

The first example maps the drive admtools only to the user Administrator. The second example maps a share called hr to the Human Resource Dept, based on the output of a tool called ifmember.exe. This tool is found in the Microsoft Windows 2000 Resource Kit.

While space does not allow for lengthy examples, check out the resources mentioned above for more examples of logon scripts. If you are comfortable with writing scripts, try a few of your own. Some very useful variables are: %USERNAME%; %USERDOMAIN%; % HOMEDRIVE%; %HOMEPATH%; $OS%; %HOMESHARE%; and %PROCESSOR%. Although self-explanatory, you will find these variables of great use in writing logon scripts.


Barrie Sosinsky (barries@killerapps.com)is president of consulting company Sosinsky and Associates (Medfield MA). He has written extensively on a variety of computer topics. His company specializes in custom software (database and Web related), training and technical documentation.

Did this tip float your boat? If so, why not let us know? E-mail us and sound off. Or visit our tips page and rate this, and other, tips.

Related Book

Windows NT/2000 ADSI Scripting for System Administration
Author : Thomas Eck
Publisher : Macmillan Technical Publishing
Published : Mar 2000
Summary:
This book will provide system administrators with solutions to automate and simplify the configuration and management of their networks. The author will present expert tips, code development and proven in real-world enterprise environments.


Rate this Tip
To rate tips, you must be a member of SearchNetworking.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Network Engineering
How to test LAN switch energy efficiency
Testing LAN switch power consumption: A best practices guide
Desktop virtualization network requirements
Preventing hacker attacks with network behavior analysis IPS
Internal cloud computing on the cheap: Free automated provisioning?
Improved storage performance without adding more disk
Troubleshooting -- 'Network Know-How' Chapter 17
Windows Server 2008 IP routing configuration: Static and dynamic RIPv2
Understand Windows tracert output to troubleshoot network connectivity
Using tracert and TTL to troubleshoot network connectivity problems

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Networking Solutions for Business

Alcatel-Lucent Network Business Communications Solutions

About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts