The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

InitialSessionState.ImportPSSnapIn Method (String, PSSnapInException)


Updated: April 27, 2016

Applies To: Windows PowerShell

Adds a snap-in to the initial session state. When the snap-in is added to the collection, the assembly is loaded and all elements (cmdlets, formats, and types) are added to the corresponding elements in the InitialSessionState object. This method is introduced in Windows PowerShell 2.0.

Namespace:   System.Management.Automation.Runspaces
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

public PSSnapInInfo ImportPSSnapIn(
	string name,
	out PSSnapInException warning


Type: System.String

The name of the snap-in to import.

Type: System.Management.Automation.Runspaces.PSSnapInException

A PSSnapInException object that contains a warning message.

Return Value

Type: System.Management.Automation.PSSnapInInfo

Returns a PSSnapInInfo object for the loaded snap-in.

Return to top

Community Additions