From the course: PowerShell for Security Professionals

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

PowerShell scripting demo

PowerShell scripting demo

Hey, everybody, welcome back to the PowerShell for Security Professionals course. In this lesson, I wanted to just show some more examples of different things we can do with some pretty simple PowerShell scripts. And I have a few examples, mostly using the for loop, because that's probably going to be one of the most common operators you're going to be using while writing different PowerShell scripts. And so we'll go over a few examples of just little kind of tiny scripts that we can write just so that we solidify our understanding of some of the concepts we covered. So, the first example I wanted to show you is building out a way for us to get a sequence of numbers and print them to the console. So, if we wanted to do this, we'd start by making a for loop. And let's create a variable. Let's call it number. So, for each number. And let's set this number equal to start at zero. We use the colon to go on to the next part. And we will set the max value for number to something like 25…

Contents