5.1. Startup

When you execute a command such as:

PowerShell

or:

PowerShell -PSConsoleFile consoleFileName

from the command line, several things happen. The relevant console file is loaded. If no console file is specified, then the default console is loaded. If you specify a console file to load, the specified console file is loaded, if available. If not, then the default console is loaded.

A console file for Windows PowerShell version 1.0 has the suffix .psc1. You can create a console file to capture the current configuration settings of PowerShell, using the export-console cmdlet. A console file summarizes configurations for a PowerShell console. The console file is an XML file with the following basic structure:

<?xml version="1.0" encoding="utf-8"?>
<PSConsoleFile ConsoleSchemaVersion="1.0">
   <PSVersion>1.0</PSVersion>
   <PSSnapIns />
</PSConsoleFile>

The behavior of the console that is loaded is open to modification by commands contained in any profile files that have been created on the machine.

5.1.1. Snapins

Once the default console file or a specified console file is loaded, the PowerShell snapins are loaded. A snapin is a group of PowerShell cmdlets or providers that, typically, share some functionality. You can create your own snapins or use snapins created by third parties. By default, the core PowerShell snapins are loaded. The core PowerShell snapins each have their own namespace.

To find out which snapins are loaded in a PowerShell console, use the following command: ...

Get Professional Windows® PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.