November 2018
Intermediate to advanced
566 pages
17h 15m
English
First things first: we assign a script block to the $Condition variable. You tell PowerShell that the value of the variable is of the script block type by enclosing the entire condition in curly braces.
Next, we proceed with setting the breakpoint in the same way as in the previous recipe, Using breakpoints, except we add the Action parameter. This action parameter contains the condition. The breakpoint is activated only if the condition is met. To verify this, change the assignment operator on line 3 to += from =, remove the breakpoint, and use the same conditional breakpoint. This time, your script will simply execute without hitting the break.
Read now
Unlock full access