0
0
PowerShellscripting~5 mins

PSSession management in PowerShell - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a PSSession in PowerShell?
A PSSession is a persistent connection to a remote computer that allows you to run commands and scripts on that computer as if you were working locally.
Click to reveal answer
beginner
How do you create a new PSSession to a remote computer named 'Server01'?
Use the command: New-PSSession -ComputerName Server01 to create a new session to 'Server01'.
Click to reveal answer
beginner
How can you list all active PSSessions in your current PowerShell session?
Use Get-PSSession to see all active PSSessions you have open.
Click to reveal answer
beginner
What command closes a specific PSSession stored in a variable $session?
Use Remove-PSSession -Session $session to close and remove that session.
Click to reveal answer
intermediate
Why is it useful to use PSSessions instead of running commands directly with Invoke-Command?
PSSessions keep the connection open, so you can run multiple commands efficiently without reconnecting each time. This saves time and resources.
Click to reveal answer
Which command creates a new persistent remote session in PowerShell?
ARemove-PSSession
BNew-PSSession
CGet-PSSession
DInvoke-Command
How do you see all your active remote sessions?
AGet-RemoteSession
BShow-PSSession
CGet-PSSession
DList-PSSession
What does Remove-PSSession do?
ACloses and removes a session
BLists sessions
CCreates a new session
DRuns a command remotely
Why use PSSession over Invoke-Command for multiple commands?
APSSession keeps connection open for efficiency
BPSSession is slower
CInvoke-Command keeps connection open
DNo difference
Which command runs a command inside an existing PSSession stored in $session?
ANew-PSSession -Session $session
BRemove-PSSession -Session $session
CGet-PSSession -Session $session
DInvoke-Command -Session $session -ScriptBlock { }
Explain how to create, use, and close a PSSession in PowerShell.
Think about the lifecycle of a remote session.
You got /3 concepts.
    Describe the benefits of using PSSession management for running multiple remote commands.
    Consider time and resource savings.
    You got /3 concepts.