I have a script that can be run either locally or remotely (via WinRM), however I would like it to behave slightly differently when run on a remote machine. I realise that
Get-Host returns, amongst other information a Name:
Get-Host
Name
PS> (Get-Host).Name ConsoleHost PS> (Invoke-Command -ComputerName dev2 -Script {Get-Host}).Name ServerRemoteHost