Note: This tip requires PowerShell 2.0 or above.
Every PowerShell host implements the $pid automatic variable which refers to the process ID of the PowerShell host process. Using it, we can find the name of the PowerShell host process within a script or a command.
(Get-Process -Id $pid).Name
The above snippet outputs process name such as powershell and powershell_ise for PowerShell.exe and PowerShell_ISE.exe respectively. Or any other process name depending on the script editor (such as PowerShell Plus, etc) or the PowerShell host you have installed.