CmdID / PowerShell / Cmdlets / Export
Export-Console
Exports the names of snap-ins in the current session to a console file. PowerShell reference
From the PowerShell reference 5 parameters
What it does
Exports the names of snap-ins in the current session to a console file. The Export-Console cmdlet exports the names of the Windows PowerShell snap-ins in the current session to a Windows PowerShell console file (.psc1). You can use this cmdlet to save the snap-ins for use in future sessions. To add the snap-ins in the .psc1 console file to a session, start Windows PowerShell (powershell.exe) at the command line by using Cmd.exe or another Windows PowerShell session, and then use the PSConsoleFile parameter of powershell.exe to specify the console file. For more information about Windows PowerShell snap-ins, see about_PSSnapins.
Export-Console [[-Path] <String>] [-Force] [-NoClobber] [-WhatIf] [-Confirm] [<CommonParameters>]
Export the names of snap-ins in the current session
PS C:> Export-Console -Path $PSHOME\Consoles\ConsoleS1.psc1IdentifyExport the names of snap-ins to the most recent console file
Export-ConsoleIdentifyAdd a snap-in and export the names of snap-ins
Add-PSSnapin NewPSSnapin
Export-Console -Path NewPSSnapinConsole.psc1
powershell.exe -PSConsoleFile NewPsSnapinConsole.psc1IdentifyExport names of snap-ins to a specified location
PS C:> Export-Console -Path Console01
PS C:> notepad console01.psc1
<?xml version="1.0" encoding="utf-8"?>
<PSConsoleFile ConsoleSchemaVersion="1.0">
<PSVersion>2.0</PSVersion>
<PSSnapIns>
<PSSnapIn Name="NewPSSnapin" />
</PSSnapIns>
</PSConsoleFile>IdentifyDetermine the console file to update
powershell.exe -PSConsoleFile Console01.psc1
Add-PSSnapin MySnapin
Export-Console NewConsole.psc1
$ConsoleFileName
Add-PSSnapin SnapIn03
Export-ConsoleIdentifyIts page in the reference: Export-Console.
Parameters
-ForceIndicates that this cmdlet overwrites the data in a console file without warning, even if the file has the read-only attribute. The read-only attribute is changed and is not reset when the command finishes.-NoClobberIndicates that this cmdlet does not overwrite an existing console file. By default, if a file occurs in the specified path, Export-Console overwrites the file without warning.-PathSpecifies a path and file name for the console file (*.psc1). Enter an optional path and name. Wildcard characters are not permitted.
If you specify only a file name, Export-Console creates a file that has that name and the .psc1 file name extension in the current directory.
This parameter is required unless you have opened Windows PowerShell with the PSConsoleFile parameter or exported a console file during the current session. It is also required when you use the NoClobber parameter to prevent the current console file from being overwritten.
If you omit this parameter, Export-Console overwrites the console file that was used most recently
in this session. The path of the most recently used console file is stored in the value of the
$ConsoleFileName automatic variable. For more information, see about_Automatic_Variables.-ConfirmPrompts you for confirmation before running the cmdlet.-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.