Open the PowerShell script file with File > Open File…Set a breakpoint – select a line then press F9.Press F5 to start debugging.
Can I debug PowerShell with Visual Studio?
The program field is used to launch pwsh so that the cmdlet being debugged can be run. … You must use the integrated terminal to run the PowerShell commands you want to debug. If the debugger doesn’t stop at any breakpoints, look in the Visual Studio Code Debug Console for a line that says: Loaded ‘/path/to/myModule.
How do I debug a PowerShell script from the command line?
- On the focused line use the F9 key to set a breakpoint.
- Right-click next to a line and choose Toggle Breakpoint to set a breakpoint.
- Use the Set-PSBreakPoint specifying a line, variable, function, or matched text.