Save (and Load) Current PowerShell Configuration

by Apr 14, 2009

PowerShell can be configured in a multitude of ways. Most often, you use Add-PSSnapin to load additional snap-ins with more cmdlets and providers. You should use Export-Console to save your current configuration to file. This is also a great way of looking at the configuration details:

Export-Console $homeconsole.psc1
Get-Content $homeconsole.psc1

The result is XML. If you have loaded any additional snap-ins, they appear in the <PSSnapins> section.

The primary advantage of console configuration files is that you can use them to load back the original configuration. Simply launch PowerShell with the parameter -psconsolefile and specify the path to your .psc1 file.