Debugging Powershell scripts

Nov 8, 2022
33
0
Can I debug Powershell scripts? In my (v24-)version on debug my standard Editor is opened when I try to debug.

Should I switch to v28?

Thanks - Michael
 
This .btm file will launch your PowerShell Script in the PowerShell ISE for debugging...
Code:
@setlocal
@echo off

echo Generating Powershell Script...

type <<- endtext > psise.ps1
Write-Host Good Day!
(get-date).tostring()
endtext

echo Launching Powershell Script in Debugger...

powershell_ise psise.ps1

echo All done!
endlocal

You can even launch your .btm via the TCC Debugger...
Code:
bdebugger psise.btm
...which will then launch the PowerShell ISE to debug your PowerShell Script, and then return to the TCC debugger to finish debugging the .btm.

Joe
 
Thanks but this "only" ist a shortcut to Powershell ISE with the disadavantage that I have to copy with two different debug tools.

BTW: The same holds tru if i switch to VS Code for Powershell debugging.

I obviously have to live with two different debug tools.

Michael
 
I don't know a debugger that could debug two contexts at once.
Even VS Code will only run one debugger of all the configured ones.