Overview
The inclusion of Windows Scripting Host (WSH) in Windows provides a rich and powerful environment for System Administrators to manage and administer their Windows machines. With a little VBScript knowledge you will soon be able to take advantage of the improved effectiveness and efficiency that scripts can give your working life. Computers were originally designed to take away the drudgery of dull, repetitive tasks, but unfortunately administering them generates dull, repetitive tasks such as monthly/weekly defrags, making the same registry change on machine after machine. Scripting allows us to give those tedious jobs back to the machine that was designed to handle them in the first place.
This course will start with the basics of using scripts to manipulate an object based environment. The course will then use VBScript to access and manipulate the WSH objects, the FileSystemObject, the Excel object model and the ADO objects for accessing databases. You will learn how to write scripts that automate applications, parse log files for specific information, map network drives, and install printers and applications, amongst others things. Due to the practical nature of scripting, there will be a large element of hands on lab work with an emphasis on creating reusable, useful sample scripts that can be employed in the work place.
The course will be delivered as an interactive lecture including many hands-on exercises.
Course Details
Delegates will learn how to
- Identify the benefits of scripting tasks
- Use scripts to automate repetitive tasks
- Write scripts that manage a users network printers and drives
- Automate the running of various programs such as disk defragmenter
- Edit the registry with scripts
- Gather network information using scripts
- Read, and write to log files
- Write scripts that can be launched remotely
- Identify the mechanisms used to access spreadsheets and databases
- Use scripts to read and write information to spreadsheets and databases
Object Fundamentals
What is an object
- Type libraries and classes;
- How to create and use objects;
What are properties and methods
- How to access properties and methods;
- How to identify the available objects in a library;
- How to identify the available properties and methods
Automating Applications and command line tools
- Using the WSH Shell object to launch applications, control them and manipulate their output;
- Creating a ping function to check machine availability.
User Input through WSH
- Getting user input through arguments and the standard input streams.
The Registry
- Reading information from the registry;
- Deleting registry values and keys;
- Creating and modifying the registry.
Shortcuts
- Creating shortcuts;
- Accessing the paths to special folders via script.
The Network Object
- Mapping network drives;
- Enumerating mapped drives and installed printers;
- Installing printers via script.
Folders
- Enumerating folders;
- Creating and deleting folders;
- Reading and modifying folder properties;
- Retrieving drive information.
Files
- Enumerating files;
- Creating and deleting files;
- Reading and writing to files;
- Sending emails via the FileSystemObject.
Remote Scripting
- Configuring your systems to support Remote WSH;
- Running scripts on remote machines.
Spreadsheets
- Using the Excel objects to read from and write to spreadsheets.
Databases
- Using the ActiveX Data Object model to access databases;
- System DSNs;
- Reading and Writing to SQL databases.
Appendix 1 VBScript – Controlling Flow
Appendix 2 Environment Variables
- Accessing Environment Variables in script.
Appendix 3 WMI
- Using simple scripts to utilise Windows Management Instrumentation (WMI);
- The WMI scriptomatic tool.
Appendix 4 Introduction to ADSI
- Using simple scripts to utilise Active Directory Services Interface (ADSI);
- The ADSI scriptomatic tool
Prerequisites
The course is written for administrators/IT professionals who have some knowledge of VBScript and would like to use that knowledge to ease their administrative burden by automating repetitive tasks. The typical attendee will be an administrator/IT professional who is interested in examining how scripts can benefit and enhance their day-to-day environment
This course assumes knowledge of VBScript mechanisms. This information is covered in the Introduction to Script Programming with VBScript course from QA QAINTSCR. It also assumes knowledge of the Windows interface.