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] [-Force] [-NoClobber] [-Confirm] [-WhatIf] [CommonParameters] Key: -Path string The path to the console file (*.psc1). If you type only a file name, Export-Console creates a file (with the ".psc1" extension) in the current directory. This parameter is required unless you have opened 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 -path, Export-Console will overwrite the console file that was used most recently in this session. The path to the most recently used console file is stored in the $ConsoleFileName automatic variable. For more information, see about_Automatic_Variables. -force Overwrite 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 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, -WarningAction, -WarningVariable, -OutBuffer -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.
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
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
© Copyright SS64.com 1999-2013
Some rights reserved