Chapter 21. Creating Scripts
WHAT'S IN THIS CHAPTER?
Using scripts at the right time
Working with the PowerShell ISE
Creating a basic script
Using and testing the script
The old command line allows a number of different kinds of automation. Of course, the oldest form of automation is the batch file. The script was introduced later, and it provides considerably more flexibility than working with batch files. The scripts provided by Windows PowerShell are even more powerful. You can perform a significant number of tasks using them. For the most part, you can access any managed portion of the .NET Framework using a script, which means you have access to just about everything in Windows.
Windows PowerShell supports both scripts and cmdlets. A script is a series of commands contained in a text file that PS interprets. It's possible to execute scripts from the command line or make them part of the shell using the
Make-Shell utility. A cmdlet is a compiled executable in DLL format. As with the script, you begin with a text file containing commands that the C# Compiler (CSC) turns into an executable. To use a cmdlet, you must make it part of the shell. Chapter 22 discusses cmdlets in more detail.
This chapter isn't a complete guide to Windows PowerShell scripts, but it does provide an excellent start. Not only will you discover when to use scripts, but you'll also see a new feature, the PowerShell Integrated Scripting Environment (ISE). PowerShell ISE is a special kind of editor that makes ...