Windows PowerShell contains several features that help with debugging.
You start with the least complex feature the write debug command write debug works almost the same as
write verbose by default Windows PowerShell suppresses debugging output.
When you run a script or function, you must add the debug parameter to display the debug output.
When write debug displays output, it also pauses.
Script execution.
This pause gives you time to evaluate what the script has already done.
You also have the option to suspend the script when you suspend a script.
Windows PowerShell displays a modified prompt.
That prompt is basically inside the scope of whatever script or function you are running.
You can view variables, run commands, and perform other tasks as if you are inside the script or function.
When you are finished, run exit to return to the debugging prompt.
The prompt also offers the option to cancel the script or function.
Write debug is not the most flexible or mature debugging technology in Windows PowerShell.
However, it is one of the easier areas to start debugging.
Many Windows PowerShell users add right debug to their scripts as they are writing those scripts.
Their write debug commands serve as a kind of inline documentation and by using them, users can start
debugging immediately if they encounter a problem with their scripts.