Implicit remoting reduces repeated computer names, credentials, ports, and authentication settings by keeping a remote session open and exposing its commands locally. section 18.0
Use the technique in a short sequence:
- Create a PSSession with the remote computer. section 18.4
- Import the desired module into that remote session. section 18.4
- Import the session’s commands with an optional prefix, creating local shortcuts that execute remotely. section 18.4
PS C:\> $session = new-pssession -comp SRV02 #1
PS C:\> invoke-command -command { import-module activedirectory } #2
session $session
PS C:\> import-pssession -session $session -module activedirectory -prefix rem #3
ModuleType Name ExportedCommands #4
---------- ---- ----------------
Script tmp_2b9451dc-b973-495d... {Set-ADOrganizationalUnit, Get-ADD...
This command sequence imports the Active Directory module from SRV02 and exposes its commands locally with the rem prefix. section 18.4
