1

When I use Enter-PSSession with Powershell I get a new prompt like

[HOSTNAME]:>

This is nice, but I'm wondering if there's a way to have it not do that, and just default to the regular Powershell prompt.

The reason I ask is that I already have the hostname set in my normal prompt function, so my prompt ends up looking like

[HOSTNAME] <PWD> [HOSTNAME]>

which is sort of unnecessary.

Is there any way to override this feature?

Kris Harper
  • 5,672
  • 8
  • 51
  • 96

1 Answers1

2

You can redefine your prompt for remote session like this :

$session = New-PSSession MyRemoteServer
Invoke-Command -Session $session -ScriptBlock {
    function prompt { your_prompt_here }
}
Enter-PSSession -Session $session

look here for a prompt function that override the pre-prompt [computername]:

Community
  • 1
  • 1
Loïc MICHEL
  • 24,935
  • 9
  • 74
  • 103