Date 2 2 24 Flow Control - Shadowsarespooky/TechJournal GitHub Wiki
PowerShell
If/Else Comparison:
- -gt greater than, -lt less than, -ne not equal to,
String Comparisons with -like:
- -like is default, case insensitive
- -ilike is
- -clike is case sensitive
Wildcard Characters:
- * zero or more characters
- ? match one character in that position
- `* match any character as a literal
- [] match a range of characters or specific characters
Regex & -match:
- -match checks if a string contains regex
-contains:
- checks if a value is in a collection
- Ex like a group of ip addresses
Arrays:
- @ is used to define an array
- .count gives number of elements
- .GetUpperBound() to get the max index number
- -join is use to change the splitter between the elements in the array
- -contains check if element exists in array
- -in see if object is in array
- You can make a custom object filled array
Functions:
- Dot Notation, used to call functions from other script files