PowerShell eBook (2)
[Pages:25]PowerShell eBook (2)
by Tobias Weltner
Index
by Tobias Weltner
03 Chapter 7. Conditions 18 Chapter 8. Loops 29 Chapter 9. Functions 42 Chapter 10. Scripts 51 Chapter 11. Error Handling 61 Chapter 12. Managing Scope 72 Chapter 13. Text and RegularExpressions 100 Chapter 14. XML
Chapter 7. Conditions
Conditions are what you need to make scripts clever. Conditions can evaluate a situation and then take appropriate action. There are a number of condition constructs in the PowerShell language which that we will look at in this chapter.
In the second part, you'll employ conditions to execute PowerShell instructions only if a particular condition is actually met.
Topics Covered:
? Creating Conditions ? Table 7.1: Comparison operators ? Carrying Out a Comparison ? "Reversing" Comparisons ? Combining Comparisons ? Table 7.2: Logical operators ? Comparisons with Arrays and Collections ? Verifying Whether an Array Contains a Particular Element
? Where-Object ? Filtering Results in the Pipeline ? Putting a Condition
? If-ElseIf-Else ? Switch
? Testing Range of Values ? No Applicable Condition ? Several Applicable Conditions ? Using String Comparisons
? Case Sensitivity ? Wildcard Characters ? Regular Expressions ? Processing Several Values Simultaneously ? Summary
03
Creating Conditions
A condition is really just a question that can be answered with yes (true) or no (false). The following PowerShell comparison operators allow you to compare values,
Operator
-eq, -ceq, -ieq -ne, -cne, -ine
-gt, -cgt, -igt
-ge, -cge, -ige -lt, -clt, -ilt -le, -cle, -ile
-contains, -ccontains, -icontains
-notcontains,
-cnotcontains, -inotcontains
Coventional Description
=
equals
not equal
>
greater than
>=
greater than or equal to
<
less than
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- powershell github pages
- welcome to cyber aces module 3 this module provides an
- contents include powershell
- mastering active directory with powershell
- powershell 4 0 language reference
- powershell ebook 2
- powershell cheat sheet v1 0 importing exporting converting
- jeffrey richter guide to working with azure storage tables
- powershell cheat sheet import export convert