Most sophisticated PowerShell editors have built-in debugging support. PowerShell can handle breakpoints natively, too, though. To make PowerShell stop execution in a script, here is how:
Set-PSBreakpoint -Script c:\scripts\somescript.ps1 -Line 4
Next time you run this script from within your PowerShell session, it will stop at line 4, and you find yourself in a debugging mode where you can access (and change) all variables. To make the script continue, use the command "continue". To remove all breakpoints, use this line:
Get-PSBreakpoint | Remove-PSBreakpoint