Using functions can save you so much time. Instead of typing the same code over and over you can make a function. Remember a function should only output 1 thing. Never make a function that outputs multiple things. For example, print to screen, write to file, and send email.Cmdlets in PowerShell are just functions. There…
All posts in Uncategorized
Objects
So first remember everything in PowerShell is an object. What exactly is an object? It’s something that has some kind of properties. For example, a string can be an object. It has characters, a length along with other items. If you ever need to learn more about an object just remember Get-Member is your friend.…
PowerShell Loops
In PowerShell scripting there are several types of loops. This page will explain what a loop is, the different types and how to know what loop to use for a particular task. So a loop just runs code over and over in a loop until some condition is met. One condition could mean that there…
Boolean
Boolean values are just statements that return true or false. For example, does 1 + 1 equal 2? This would be true. How would this look in code well here is an example. Notice in the above if statement since $result was -eq (equal) to 2 the text “My value is equal to 2” was…
Variables
I’m going to act like you’re brand new to scripting. So think of a variable as a bucket you can store a type of data in that is referenced as a word. Also note that variables in PowerShell start with a $ symbol. For example, we can create a variable called $FirstName that contains the…