Questions about interactive sessions

Hey guys,

I’m trying to implement a quick and small system summary that is displayed at the beginning of interactive remoting sessions.

Like landscape in Ubuntu for example:

Now for the questions - I’ve done a quick procmon capture but couldn’t find any anything about a last login timestamp for remoting sessions.

  1. are timestamps for remoting sessions stored on either the source or destination system?

  2. is there a way (variable?) that indicates that a remoting session is interactive?

Thanks in advance :slight_smile:

Remoting sessions aren’t a “logon.” They’re a network authentication, just like accessing a shared folder, so they’re logged in the same way. Apart from any custom logging, which you could potentially implement as a startup script in a custom endpoint, there isn’t any other logging. WMF5 offers some new logging options, but yo don’t mention if that’s what you’re using so I don’t want to assume you are :slight_smile:

And remoting sessions are never “interactive.” That isn’t how they work. Using Enter-PSSession is essentially the same as using New-PSSession and then repeated Invoke-Command commands. The typing is done in your local console (not like SSH), and when you hit enter it’s sent to the remote machine for execution.

Hey Don,

Thanks for the response. I like the idea of a startup script with a custom endpoint. I’ll look into that.

With interactive I primarily meant that I can freely send commands to the remote system without having to use invoke-command with a pre-created session all the time. I know that remoting sessions don’t work like SSH because everything is just being deserialized before being sent to me from the remote system and displayed on my end.

My goal is really just to get a quick summary of the remote system when I use enter-pssession but I don’t want this “summary” to run during sessions that are created with new-pssession.

I’d be happy to know if there’s anything in PSv5 that would enable me to implement this since I’m eagerly waiting for the official WMF5 release :smiley:

Problem being that the remote computer only “sees” one kind of session. It can’t tell the difference in how they were created. Sessions created with Invoke-Command, New-PSSession, and Enter-PSSession are all exactly the same.

Take a look at the session Jeff Hicks and Lee Holmes did at PowerShell Summit NA 2015. They’re at in a playlist. They cover a lot of the new logging functionality.