I want to skip the Start-Transcript and Stop-Transcript lines if the PowerShell script is running by PowerShell ISE.
Is this possible? And how can I achieve this?
You can do:
if ($host.name -eq 'ConsoleHost') # or -notmatch 'ISE'
{
.. do something ..
}
else
{
.. do something else..
}