From the course: PowerShell: Automating IT Administration

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Using conditional statements and comparisons

Using conditional statements and comparisons - PowerShell Tutorial

From the course: PowerShell: Automating IT Administration

Using conditional statements and comparisons

- [Instructor] So, here we are on a Windows 11 machine. And first off, there's a couple of things that have been installed. If I click into the PowerShell here, as it's Windows 11, we have the Windows terminal installed. And so I've installed PowerShell 7. If I'd use the drop down, you can see I have Windows PowerShell, and I also have PowerShell. That means I've installed Windows 7 PowerShell. Secondly, I've also installed Visual Studio Code purely based on the fact that I have some files I wish to utilize. And so it's easier as an editor to be able to go through and see them. So now that we've got that, let's focus on understanding conditional statements and comparison. Now, PowerShell provides a platform for us to be able to do some kind of logic that will say, "Hey, if this is this, do that." And to make it more complicated too. So as a simple example here, in our first one, we've defined a variable. The…

Contents