liveBook · Manning

Chapter 18: Sessions: Remote control with less work

What you will learn in chapter 18 of Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS

The introduction explains why repeatedly opening remote connections is tedious and motivates reusable PowerShell sessions.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction explains why repeatedly opening remote connections is tedious and motivates reusable PowerShell sessions.

Key terms: Invoke-Command, Enter-PSSession, remoting connection, reusable sessions

18.1 Creating and using reusable sessions

This section explains what reusable PowerShell remoting sessions are, how to create and keep track of them, and when to close them.

Key terms: session, persistent connection, remote shell, New-PSSession, Get-PSSession, session object, -ComputerName, -HostName, WinRM, Remove-PSSession

18.2 Enter-PSSession with session objects

This section shows how to enter a one-to-one remote shell using an existing session object and how to find the right session when several are open.

Key terms: Enter-PSSession, Exit-PSSession, session object, Get-PSSession, PSSession object, -session parameter, ComputerName property

18.3 Invoke-Command with session objects

This section shows how to target reusable sessions with Invoke-Command, including a parenthetical alternative when session objects cannot be piped to it.

Key terms: Invoke-Command, session objects, $session01, -session parameter, parenthetical command, pipeline

18.4 Implicit remoting: Importing a session

This section explains how implicit remoting makes commands from a remote module available locally, why that is useful, and what limits the returned objects have.

Key terms: implicit remoting, session, temporary module, rem prefix, New-remADUser, deserialized, properties, methods

18.5 Using disconnected sessions

Explains how disconnected PowerShell sessions can be resumed and why administrators must manage the remote shells they leave running.

Key terms: PowerShell v3, Enter-PSSession, -ComputerName, session, disconnected sessions, reconnect, session’s ID number, WSMan drive, IdleTimeout, MaxConcurrentUsers

18.6 Lab

18.7 Lab answers

18.8 Further exploration

Prompts the reader to look for products in their environment whose PowerShell modules may be accessible through remoting.

Key terms: PowerShell-enabled products, PowerShell modules, PowerShell remoting

Concepts explained in this chapter

← Chapter 17: Input and output Chapter 19: You call this scripting? →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.