ENTER-PSSESSION Powershell Tool

Comments

6 comments

  • Stephen Valdinger

    Something like this:

    $(Computer:TARGETHOSTNAME) is a variable available in that menu to the right marked (x) in blue.

     

    Yields this:

     

    0
    Comment actions Permalink
  • Mike Robertson

    Awesome!  Works like a charm! Thanks.

    0
    Comment actions Permalink
  • Tyson Bryner

    Interesting.. I've created the same tool, but it doesn't seem to connect to the remote machine. It leaves me at an open powershell prompt on my local local machine in the admin arsenal temp folder.

    From there I can type the Enter-PSSession command and it works, but I can't get it to enter automatically.

    0
    Comment actions Permalink
  • Donato Brea

    Same here. It used to work as described but after one upgrade it change it behavior to what @TysonBryner mentioned.

    0
    Comment actions Permalink
  • James Gater

    For those that searched for this solution like me, I managed to get this working in Inventory 17 using quotes around the variable and ensuring 'leave shell open' was set. (You can obviously choose your own shortcut key!)

    remote powershell session

    0
    Comment actions Permalink
  • Brett L

    Couple of things about doing this.

    1) You are leaving sessions to computers open. Just closing the powershell window does not actually remove the session. You need to exit then issue remove-pssession 

    2) The full script is easy. Because you should be closing your sessions, you should be required to have the new-pssession line every time you attempt to re-connect.

    $Session = New-PSSession -computername $(Computer:TARGETHOSTNAME)
    Enter-PSSession $Session

    0
    Comment actions Permalink

Please sign in to leave a comment.