Export-Console

 

SYNOPSIS

Exports the configuration of the current console to a file so that you can reuse or share it.

 

SYNTAX

Export-Console [[-path] <string>] [-force] [-noClobber] [-whatIf] [-confirm] [<CommonParameters>]

 

DETAILED DESCRIPTION

The Export-Console cmdlet exports the configuration of the current console to a Windows PowerShell console file (.psc1). You can use this cmdlet to save a console configuration that you changed by changing its properties or by adding a Windows PowerShell snap-in to the console.

 

PARAMETERS

 

-path <string>

Specifies a path and file name for the console file (*.psc1). Enter a path (optional) and name. Wildcards are not permitted.

 

If you type only a file name, Export-Console creates a file with that name and the ".psc1" file name extension in the current directory.

 

This parameter is required unless you have 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 (replaces the content of) the console file that was used most recently during this session.

 

Required?

false

Position?

1

Default value

 

Accept pipeline input?  

true (ByValue, ByPropertyName)

Accept wildcard characters? 

false

 

-force <SwitchParameter>

Overrides restrictions that prevent the command from succeeding, just so the changes do not compromise security. Force allows you to overwrite the data in a console configuration 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.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-noClobber <SwitchParameter>

Will not overwrite (replace the contents) of an existing file. By default, if a file exists in the specified path, Export-Console overwrites the file without warning.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-whatIf

Describes what would happen if you executed the command without actually executing the command.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-confirm

Prompts you for confirmation before executing the command.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".

 

INPUT TYPE

none

 

RETURN TYPE

FileInfo object

 

NOTES

 

For more information, type "Get-Help Export-Console -detailed". For technical information, type "Get-Help Export-Console -full".

 

The name of the current console file is automatically stored in the $ConsoleFilename variable. If the variable has a no value, the current console is the default console for Windows PowerShell.

 

To use a Windows PowerShell console file in a new session, use the following syntax to start Windows Powershell:

"powershell.exe -PsConsoleFile <ConsoleFile>.psc1".

 

For information about the Windows PowerShell snap-ins that you can add to your console (and use Export-Console to save), type "Get-Help About_PSSnapins".

 

When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

 

EXAMPLE 1

 

export-console -path $pshome\Consoles\ConsoleS1.psc1

 

This command exports the current console configuration to the ConsoleS1.psc1 file in the Consoles subdirectory of the directory stored in $pshome. By default, $pshome stores the path to the Windows PowerShell installation directory. To see the value of this variable on your computer, type "$pshome".

 

EXAMPLE 2

 

export-console

 

This command exports the current console configuration to the Windows PowerShell console file most recently used during the current session, where it overwrites the console configuration that was in the file.

 

If you haven't exported a console file during the current session, you are prompted for permission to continue and then prompted for a file name.

 

EXAMPLE 3

 

add-pssnapin NewPSSnapIn

 

export-console -path NewPsSnapinConsole.psc1

 

powershell.exe -PsConsoleFile NewPsSnapinConsole.psc1

 

These commands add the NewPsSnapin Windows PowerShell snapin to the current console, export the current console, and then start a Windows PowerShell session with the new console.

 

The first command uses the Add-PsSnapincmdlet to add the NewPsSnapin snapin to the current console. You can only add snapins that are registered in your system.

 

The second command exports the console that includes the snap-in to the NewPsSnapinConsole.psc1 file.

 

The third command starts Windows PowerShell with the NewPsSnapinConsole.psc1 file.

 

When you add a Windows PowerShell snap-in to the console, the providers and cmdlets that the snap-in supports are available immediately. You don't need to start a new session. However, because the snap-in is added only to the current console, new sessions will not include the snap-in unless you export the current console and then specify that console when you open Windows PowerShell again.

 

EXAMPLE 4

 

export-console -path Console01

 

This command exports the current console configuration to the Console01.psc1 file in the current directory. This command uses the Path parameter to specify a name for the console file. By default, Export-Console appends the .psc1 file name extension and saves the file in the current directory.

 

EXAMPLE 5

 

export-console MyConsole

 

$ConsoleFilename

 

These commands export the current console configuration to the MyConsole.psc1 file and then use the $ConsoleFilename variable to find the current console.

 

The first command uses Export-Console to export the current console configuration to the MyConsole.psc1 file in the current directory. It uses the Path parameter, but omits the optional parameter name.

 

The second command uses the $ConsoleFilename variable to find the name of the current console file:

 

MyConsole.psc1

 

RELATED LINKS

Add-PSSnapIn

Get-PSSnapIn

Remove-PSSnapIn

 

 

 

508 Resource Limit Is Reached

Resource Limit Is Reached

The website is temporarily unable to service your request as it exceeded resource limit. Please try again later.