I am creating an automation script that will be moving in and out and numerous PS Remote sessions. The connection process was built before my time and logging is minimal. I would like a way of reading the text that appears before the native PowerShell prompt after a remote connection is established. Example:
Starting here:
PS C:\>
Connection 1:
PS C:\> session01
New Prompt (what I would like to grab):
Session One Friendly Name PS C:\>
Connection 2:
Session One Friendly Name PS C:\> session21
New Prompt:
Session Twenty-One Friendly Name PS C:\>
And so on...
Can this information be captured? Would be very helpful for logging. I have tried variations of Get-History but that part isn't really a command and isn't captured as far as I can tell.
Couldn't get your need completely, but I Hope you want to capture the prompt.
you can do
Get-Contenet Function:\Prompt
to get prompt value and is an automatic function which executes on each carriage return.