Export the current console configuration to a file so that you can reuse or share it. The console configuration saved will include snap-ins and console properties. The file can then be specified when powershell is opened making the snap-in available immediately.
Syntax
Export-Console [[-path] string] Options
options:
-Path string
The path to the console file (*.psc1).
-force
Override restrictions that prevent the command from succeeding, apart
from security settings. e.g. Force will override a files read-only attribute,
but will attempt to reset the read-only attribute when the command completes.
-noClobber
Do not overwrite the contents of an existing file.
The default is to overwrite without warning.
-whatIf
Describe what would happen if you executed the command without actually
executing the command.
-confirm
Prompt for confirmation before executing the command.
CommonParameters:
-Verbose, -Debug,-ErrorAction,-ErrorVariable, -OutVariable.
If you type only a filename as the Path, powershell will create a (.psc1) file in the current directory.
If Export-Console is run repeatedly in the same session, then -Path may be omitted, in this case Export-Console will overwrite the last console file written to.
Examples
Export the current console configuration:
PS C:>export-console -path $pshome\Consoles\ConsoleS1.psc1
The $pshome variable holds the path to the PowerShell home (installation) folder.
Start a Windows PowerShell session with a set of stored console settings:
PS C:>powershell.exe -PsConsoleFile $pshome\Consoles\ConsoleS1.psc1
"Love all. Trust a few. Do wrong to none" - William Shakespeare
Related Powershell Commands:
add-PSSnapIn - Add snap-ins to the console
get-PSSnapin - List PowerShell snap-ins on this computer
Remove-PSSnapin - Remove PowerShell snap-ins from the console