Set-PSBreakpoint

noun

say it: “SET PEE-ESS BRAYK-poynt” /ˈsɛt ˌpiˌɛs ˈbreɪkˌpɔɪnt/

A PowerShell command that sets a pause point on a line of a script from the prompt, without an editor.

What does Set-PSBreakpoint do?

Set-PSBreakpoint sets a breakpoint from the prompt, with no editor needed: the script pauses before that line and gives you a [DBG]: prompt. Get-PSBreakpoint lists the breakpoints, and Remove-PSBreakpoint takes them away.

Set-PSBreakpoint -Script .\move-receipts.ps1 -Line 9
Get-PSBreakpoint                          # ID 1, move-receipts.ps1, line 9
.\move-receipts.ps1                       # pauses before line 9 at [DBG]:
Get-PSBreakpoint | Remove-PSBreakpoint    # takes it away when you're done

In a sentence

  • “On the server, which has no VS Code, Sam used Set-PSBreakpoint to pause the mover at line 9.”
  • “Set-PSBreakpoint took the script name and the line number to pause on.”

Level: Journeyman · More PowerShell terms at this level

Updated