Contact Info

Crumbtrail » Administration » Powershell » Powershell 2.0 » Export-PSSession

Export-PSSession - Powershell 2.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Short description
Imports commands from another session and saves them in a Windows PowerShell module.

Export-PSSession [-Session] <PSSession> [-OutputModule] <string> [[-CommandName] <string[]>] [[-FormatTypeName] <st
ring[]>] [-AllowClobber] [-ArgumentList <Object[]>] [-CommandType {Alias | Function | Filter | Cmdlet | ExternalScr
ipt | Application | Script | All}] [-Encoding <string>] [-Force] [-Module <string[]>] [<CommonParameters>]

The Export-PSSession cmdlet gets cmdlets, functions, aliases, and other command types from another PSSession on a l
ocal or remote computer and saves them in a Windows PowerShell module. To add the commands from the module to the c
urrent session, use the Import-Module cmdlet.

Unlike Import-PSSession, which imports commands from another PSSession into the current session, Export-PSSession s
aves the commands in a module. The commands are not imported into the current session.

To export commands, first use the New-PSSession cmdlet to create a PSSession that has the commands that you want to
 export. Then use the Export-PSSession cmdlet to export the commands. By default, Export-PSSession exports all comm
ands, except for commands that exist in the current session, but you can use the CommandName parameters to specify 
the commands to export.

The Export-PSSession cmdlet uses the implicit remoting feature of Windows PowerShell. When you import commands into
 the current session, they run implicitly  in the original session or in a  similar session on the originating comp