November 2018
Intermediate to advanced
566 pages
17h 15m
English
First, we will create a script block that contains the conditional statement. We will then use this script block with the Set-PsBreakpoint cmdlet.
Here is the script block:
PS> $Condition = { if ($Count -lt 2) { break } }
Next, place a breakpoint when the specified condition is satisfied. First, remove any existing breakpoints:
PS> Get-PSBreakpoint | Remove-PsBreakpointPS> Set-PSBreakpoint ./ch13/05-Set-Name.ps1 9 -Action $ConditionPS> # Verbose version: Set-PSBreakpoint -Script ./ch13/05-Set-Name.ps1 -Line 9 -Action $ConditionPS> ./ch13/05-Set-Name.ps1
When you hit the condition (which you will, in this case), you will enter debug mode, wherein you can start your debugging process.
Read now
Unlock full access