Creating a system initialization script
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
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 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/