Classwork 5
Classwork 5
Classwork 5
Background
Remember that incoming remoting sessions are only enabled by default on Windows
Server 2012
R2. For other operating systems, you must run Enable-PSRemoting to enable
incoming connections
Kevin Hoag
Classwork 5
Syntax Review
Remember the following
Invoke-Command can send a command, or the contents of a script file, to
one or more remote computers. You can specify computer names for ad
hoc sessions, or specify PSSession objects to use a persistent session.
Enter-PSSession lets you interact with a single remote computer. You can
specify a computer name for an ad hoc session, or a single PSSession object
to use that persistent session.
New-PSSession creates a new persistent session on a remote computer.
The resulting session object is often stored in a variable for easier access.
Import-Module can be used to import commands from a remote module.
You must specify an existing PSSession object to import from.
Enable-PSRemoting can enable remoting on the local computer. Add
–SkipNetworkProfileCheck if your computer includes network interfaces
marked as “public.” This is often the case on computers where a
workstation virtualization product is installed.
For the following exercises, provide a comma separated list of your computer
and/or virtual machine names. Use localhost to access your local computer via
remoting.
When you run a command that was imported from a remote session (like Get-
RemoteNetAdapter), and the session it was imported from no longer exists, PowerShell will
attempt to create a new session to the original computer and implicitly reimport the
command. This is a feature known as implicit remoting.
If you try running Enter-PSSession again while in a PSSession, you'll get an error. This is
because you can't enter into another PSSession from within an existing one.
Kevin Hoag
Classwork 5