In This Chapter
Getting your feet wet with Windows PowerShell
Writing your first script
Previewing a complex script that's as easy as pie
Throughout my career, I've found that many Windows administrators shy away from command line interfaces or any kind of scripting. Some reasons for this that have been mentioned to me are "it can be tedious," "there's a lot you need to remember," and "it's easier to make mistakes in a command line." I have to admit that these points have some validity, though this topic is highly debatable. I'm a bit of a 50/50 person myself, switching between command line and GUI tools, depending on the need.
I'm a firm believer that there's always more than one way to do things, and I always like to pick the best tool to get the job done. Some tasks are more efficient if you use a command shell, whereas others are far more convenient and less error-prone when you're using a GUI. If you're lucky, you're one of those who like to work in command line interfaces (CLI), but if not, don't let this bother you. Windows PowerShell is just another tool to help you get more done in less time.
In this chapter, I let you have a go at trying out a few Windows PowerShell scripts to see how easy it is even when doing something relatively complex such as connecting to Active Directory. More importantly, you get to see that scripts that do complex things can be just as short and simple as those that do very mundane things.