Add Conditional Logic
It is extremely common when working with Windows PowerShell to have to evaluate some data and perform some conditional action based on that evaluation. Just about every modern programming language (as well as old-school batch files) supports some mechanism to perform conditional logic. Windows PowerShell's capabilities are fully featured and mirror the capabilities of programming languages like C#, with only slight differences in syntax.
Before you start writing conditional logic statements, you must first understand Windows PowerShell's comparison operators and logic operators.
Use Comparison and Logic Operators
If you've ever written code in a language such as C# and are now working with Windows PowerShell, you may be ...
Get Automating Microsoft® SharePoint® 2010 Administration with Windows PowerShell® 2.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.