Connect To Other Servers With PowerShell Interactive Session

In this blog post, I will show you how to connect to other servers using PowerShell interactive session feature.

Interactive Session

Not many people that are new to PowerShell and PowerShell 7 know that in an Active Directory environment, connecting to member servers using from our PowerShell console is so easy and simple as you will see shortly.

The PowerShell interactive cmdlet is enter-PSSsession (no need to use caps) and if you are connected to a domain-joined machine you can connect to a member server by running the following cmdlet.

enter-PSSession server

Once connected, you will see the server name on the left side of the command line as shown above.

To exit you simply enter the cmdlet below.

exit-pssession

Another option that many admins use which is smarter of you would like to hope from one session to another is keep the session inside a PowerShell variable as shown below.

$x = new-pssession ms01
enter-pssession $x

The above method is good because we can use multiple variables for multiple connection and switch between them.

Processing…
Success! You're on the list.


Posted

in

,

by