Tip

Creating a system initialization script

Creating a system initialization script

From Essential Windows NT System Administration by Aeleen Frisch, O'Reilly and Associates, 1998

By default, Windows NT doesn't use system installation scripts at boot-time the way that many other operating systems do. However, the Resource Kit includes a service that allows you to specify a system startup script. Installing this facility involves these steps:

  • Move the files AutoExNT.Exe and ServMess.DDL from wherever you've installed the Resource Kit files to %SystemRoot%System32.
  • Add the AutoExNT service using the InstExNT utility included in the Resource Kit: C:> instexnt install [/interactive] Include the /interactive option if you want to enable the initialization script process to appear in the system process list and be accessible from the desk-top.
  • Create a Windows NT script file containing the desired commands and save it in text format as %SystemRootSystem32AutoExNT.Bat. Set the file ownership and protection as appropriate. The user account from which you plan to use the service should own it, and only this user and administrators should have anything but read access to the file (and possibly not even read access). As always, run this service with the minimum required privileges, creating a new user account for it if appropriate.
  • Start

Requires Free Membership to View

  • the AutoExNT service via the net start autoexnt command of the Services control panel applet. Note that the service will fail to start if you forget to create the AutoExNT.Bat file first.
  • Perform any additional desired configuration for the service via the usual mechanisms in the Services control panel.

Here is a simple AutoExNT.Bat script:


 	echo "Running AutoExNT.Bat" >> C:Admin_BinBoot.Log
 	date /T >> C:Admin_BinBoot.Log
 	time /T >> C:Admin_BinBoot.Log

  	C:WinNTnet.exe start lpdsvc >> C:Admin_BinBoot.Log

  	if exist C:NTToolsNAVNTN32ScanW ^
 		C:NTToolsNAVNTN32ScanW E:

 	 	C:Admin_BinPerlPerl.Exe disk_sum.pl

  	echo "Clearing the scratch directory" >> C:Admin_BinBoot.Log
 	if not exist E:G98|Scratch mkdir E:G98Scratch
 	erase /Q /F E:G98Scratch*.*
 

The beginning of the script notes the date and time of the boot in a log file. The next three commands start the service that handles incoming print jobs from UNIX systems, performs a virus scan, and run a Perl script that summarizes and records current disk usage statistics for this system. The next section of the script ensures that a scratch directory, E:G98Scratch (used by an application program), exists and is empty. The if command creates the directory if it does not exist, and the following erase command removes all files with that directory.

For more Windows NT tips see Essential Windows NT System Administration, available at http://www.oreilly.com/catalog/esawinnt/

This was first published in March 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

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.