Here we are able to learn how to debug PowerShell script, without an error we cannot complete the script in a single shot, we have to debug the code have to identify the issue need to fix it.
In PowerShell for debugger we can use windows PowerShell ISE
In Start enter the name PowerShell
Open the Windows PowerShell ISE
If you want to debug the code
Place the cursor and Press F9 or in the top menu place the cursor click on the Toggle Break Point where ever in the code you want o debug.
F10 is used to debug line by line in the current function or method.
F11 is used to debug line by line and also to debug inside the Methods or Functions.