Script debugging

Debugging in PowerShell is similar to that in other programming languages. Script debugging is available in the console host as well as in the PowerShell ISE; ISE has both GUI and cmdlet-based debugging, whereas console has only cmdlets to debug your scripts.

The debugging feature in the PowerShell ISE is available under the Debug tab, which is self-explanatory. Let's take a look at the breakpoints and debug cmdlets:

(Get-Command -Name *Debug*).Where({$_.Source -ne 'Azure' -and $_.CommandType -eq 'cmdlet'})
Get-Command -Name *BreakPoint

Note that in the first snippet, I used the where method to ignore Azure and to get only the core cmdlets; the output is illustrated in the following image:

Managing breakpoints

Windows PowerShell ...

Get PowerShell: Automating Administrative Tasks 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.