I'm trying to run several PowerShell scripts locally for file transfers and other tasks, but they appear to do nothing. There's no output and no error message. I already changed the execution policy, and these scripts worked normally until recently, so I'm not sure what changed. I'm running them from an elevated command terminal. One script displays a menu, accepts comma-separated choices, and then uses SSH to connect to different machines, but even that behavior seems to have stopped. What's the best way to diagnose a script that appears to run silently?
3 Answers
Add explicit progress or diagnostic output so you can tell how far the script gets. For example, print menu selections and variable values before using them. You can also run each command manually in the terminal, or add verbose parameters where the command supports them. Starting a transcript can help capture what PowerShell is doing.
Make sure the way you launch the script matches how it is written. Running it from an administrator terminal is useful, but try executing the individual commands directly as well. That will show whether the issue is with PowerShell, the script flow, or an external dependency such as SSH or a transfer service.
The eventual problem turned out not to be PowerShell execution policy at all. A file-transfer operation was depending on the BITS service, which was the part that had stopped working. Replacing that operation with Copy-Item resolved the issue.

If the scripts worked before, it’s worth checking which service or external command they depend on rather than assuming the script itself is being blocked.