From the course: PowerShell: Automating IT Administration
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Looping constructs for data manipulation - PowerShell Tutorial
From the course: PowerShell: Automating IT Administration
Looping constructs for data manipulation
- [Instructor] Now, another function that's really important inside PowerShell is the ability for you to loop content. Now, in one of our previous examples, we touched on it by using a foreach statement to be able to iterate through the data that we imported and we didn't focus on it too much. So I wanted to go back and talk about looping constructs. So first off, our very first one is for. It's a for loop. This is basically where we iterate until we basically tell it to do something. So if we take this line six, for example, here, we're creating a variable called $i and giving it a start number of one, which means it will begin there and then get to a specific number that we tell it. So we also then have a second section here, which is $i is less than or equal to 10. That's going to be our point that we stop. So we're going to say start at one and as long as the number is less than or equal to 10, then keep going. And…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Why automate IT administration tasks?3m 3s
-
(Locked)
What are PowerShell modules, and why are they useful?4m 2s
-
(Locked)
Using conditional statements and comparisons12m 49s
-
(Locked)
Looping constructs for data manipulation13m 40s
-
(Locked)
Manipulating data with logic tests and loops7m 58s
-
(Locked)
Working with arrays and hash tables11m 13s
-
(Locked)
Understanding PowerShell error handling22m 40s
-
-
-
-