Add one or more PowerShell snap-ins to the current console.
Syntax Add-PSSnapin [-name] string [-passThru] [CommonParameters] Key -name string Name of each PSSnapIn to add to the current console e.g. Microsoft.Exchange or MyCompany.User. -passThru Pass the object created by this cmdlet through the pipeline. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.
Standard Aliases for Add-PSSnapin: asnp
Changing the available cmdlets and providers by adding or removing snap-ins will only affect the current console.
After a snap-ins has been added, you can use the cmdlets and providers that the snap-in supports in the current session. To add the snap-in to all future PowerShell sessions, add an Add-PSSnapin command to your PowerShell profile.
Beginning in PowerShell 2.0 Modules were introduced and they almost entirely replace Snap-Ins.
Snap-Ins are still available and fully supported. Snap-Ins have to be installed, modules can be simply copied (like a script) and then made available with Import-Module
Beginning in PowerShell 3.0, the core PowerShell cmdlets are packaged in modules. The exception is Microsoft.PowerShell.Core, which is a snap-in (PSSnapin). By default, only the Microsoft.PowerShell.Core snap-in is added to the session. Modules are imported automatically on first use or you can use Import-Module to import them.
Add the Microsoft Exchange and Microsoft AD Directory Services snap-ins to the current console:
PS C:> add-PSSnapIn Microsoft.Exchange,Microsoft.Windows.AD
Add all the registered Windows PowerShell snap-ins to the console:
PS C:> get-pssnapin -registered | add-pssnapin -passthru
Save the console configuration
To save the configuration of the current console, (including any extra snap-ins that are loaded) to a (.psc1) console file use Export-Console.
PS C:> export-console C:\SS64.psc1
Restore the console configuration
To open a PowerShell console with a saved console configuration, start PowerShell with the -PsConsoleFile parameter.
PS C:> powershell.exe -psconsolefile C:\SS64.psc1
"When the character of a man is not clear to you, look at his friends" ~ Japanese Proverb
Export-Console - Export current console configuration to a file.
get-PSSnapin - List PowerShell snap-ins on this computer.
Remove-PSSnapin - Remove PowerShell snap-ins from the console.
Import-Module - Add a module to the session