I want to skip the Start-Transcript, Stop-Transcript lines if the PowerShell script is running by Powersehll ISE.
Is this possible? And how can I achieve this?
The Write-Progress cmdlet displays a progress bar in a PowerShell command window that depicts the status of a running command or script. You can select the indicators that the bar reflects and the text that appears above and below the progress bar.
The Windows PowerShell Integrated Scripting Environment (ISE) is a host application for Windows PowerShell. In the ISE, you can run commands and write, test, and debug scripts in a single Windows-based graphic user interface.
In the ISE editor window, highlight just that code and press the F8 key. F8 executes only the highlighted code. Once you've highlighted and tested each part of the code, press F5 to run the entire script and see how all the code runs together.
You can do:
if ($host.name -eq 'ConsoleHost') # or -notmatch 'ISE' { .. do something .. } else { .. do something else.. }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With