PowerShell lets you do some really neat stuff. Today were going to look at some of the tools available that can make script writing easier.
First there is the built in ability to evaluate expressions:

You can also store the output of these expressions into variables:

We can also make arrays of variables. An array is just a collection of similar objects. We add a number to each object starting from zero so we can identify the objects in the list.
|
Letter Objects |
Reference |
|
A |
0 |
|
B |
1 |
|
C |
2 |
Here is how we can use these; first I'll create the array:

Next we can call the elements in the array using their index number:

Notice that I typed $Alphabet[1] and I had "b" returned. This is because all array indexes in PowerShell start at 0.
Next we can loop through arrays.

Now for any programmers out there this is really simple stuff. But notice that I actually built this loop on the command line.
The first thing I did was create a variable to be my index.
The next thing I did was to define my constraints. I said that I wanted to DO something WHILE my Index was NOT EQUAL to 3. So once my index reached 3 my loop would stop.
Next I had to increment or add one to my index variable. The ++ is an operator you can use with any numeric that automatically adds one to a value.
As you can see the output was a then b then c.
Next we can look at the IF statement. This is important to know, and again for many programmers this is pretty basic stuff.

This IF statement tested to see if 1+1 was equal to 2. Because this is in fact true the phrase "one plus one is equal to 2" was printed out.
This covers some more basic PowerShell language tools. These are the building blocks of any kind of script. Looping will allow you to do a menial chore quickly, using IF statements allow you to build decision intelligence into your scripts, and arrays make for neat and tidy data structures for working with large numbers of similar data.