From the course: PowerShell 7 Essential Training
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Control the flow of PowerShell - PowerShell Tutorial
From the course: PowerShell 7 Essential Training
Control the flow of PowerShell
- [Illustrator] When building PowerShell scripts, it's important to be able to control the flow, of which functions and commands you wish to execute, and the order that they should happen. So let's consider something. I have a variable with the value 10 inside of it. Now, obviously what I would like to do, is to test that value. This is done by using something like this, and saying if value. Now you notice when I type this, it gives me the two arrows, because it's now waiting for me, to do something with that. The output of that is inside the squarely bracket. So I'm going to say, Write-Host we have a value and enter. And you'll see that returns, because it did a check, for the existence of something in that variable. So fairly straightforward. Now the idea behind the 'if' statement, which is the most common, is to help us structure the information. So if we go back here and type value equals 10, what we can do…
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
-
-
-
-
-
-
(Locked)
PowerShell security6m 15s
-
(Locked)
Create your first script8m 30s
-
(Locked)
Parameter attributes for scripts and functions15m 16s
-
(Locked)
Select information10m 24s
-
(Locked)
Filter specific data10m 43s
-
(Locked)
Control the flow of PowerShell8m 31s
-
(Locked)
Ternary operators2m 39s
-
(Locked)
Switch statements3m 58s
-
(Locked)
Define custom help9m 22s
-
(Locked)
-
-
-