1 - 3 IT Essentials II v2.0 - Lab 8.5.6 Copyright 2002, Cisco Systems, Inc.
Lab 8.5.6: Writing a Script in Windows 2000 Estimated Time: 30 Minutes
Objective
The objective of this lab is to learn how to write a script in Windows 2000.
Equipment
The following equipment is required for this exercise:
• A computer running Windows 2000 Professional
Scenario
The system administrator needs to create a script in the startup folder that will display on
the users desktops when they log on to their systems. To experiment with writing scripts
for that, practice with a sample script that will be created in this lab.
Procedures
In this lab, the student will create and execute a Visual Basic Script and place it the start
menu.
Step 1: Writing the Script
1. Open up Notepad. Go to Start > Programs > Accessories > Notepad.
2. Type this text into Notepad:
Dim Greeting
Dim UserName
UserName = InputBox ("Please enter your name:")
UserName = Trim (UserName)
3 - 3 IT Essentials II v2.0 - Lab 8.5.6 Copyright 2002, Cisco Systems, Inc.
5. Click OK.
6. Double-click the script again and this time type who’s asking in the box. Notice what
message is displayed and how it corresponds to the entry in the text of the script.
7. Click OK.
8. Double-click the script again and this time type Alice in the box. Notice what
message is displayed and how it corresponds to the entry in the text of the script.
9. Click OK.
10. Double-click the script again and this time type Steve in the box. Notice what
message is displayed and how it corresponds to the entry in the text of the script.
Step 3: Executing the script when the system starts
1. Navigate to the Startup folder. Go to C:/Document and Settings/All Users/Start
Menu/Programs/Startup. Drag the script file that was created in Step 1 and place it
into the folder.
2. Restart the computer and the script should execute automatically when the system
reboots.
Troubleshooting
Troubleshooting a Visual Basic Script or can be difficult since the text has to be 100
percent accurate for the script to execute properly. Review the script before it is saved
and executed to make sure that is written correctly.
Reflection
Scripts can serve a variety of functions and can be very helpful to a system administrator.
The script that was written in this lab was fairly simple script compared to how complex a
Visual Basic script can be.
1. What are some other uses for scripts?
2. Where might they be useful and where might they cause harm?