InitialSessionState Members

Represents a session state configuration that is used when a runspace is opened. The elements specified here, such as different types of commands, providers, and variables, are accessible each time a runspace that uses this configuration is opened. This class is introduced in Windows PowerShell 2.0.

The following tables list the members exposed by the InitialSessionState type.

  Name Description
  InitialSessionState Creates a new InitialSessionState object that is empty. This constructor is introduced by Windows PowerShell 2.0.
Top
  Name Description
public property ApartmentState Gets and sets the apartment state of the thread used to run commands in the runspace. This property is introduced in Windows PowerShell 2.0.
public property Assemblies Gets a collection that contains the assemblies of the initial session state. The host application can use this collection to add assemblies to the session state. This property is introduced in Windows PowerShell 2.0.
public property AuthorizationManager Gets and sets the authorization manager of the initial session state. This property is introduced in Windows PowerShell 2.0.
public property Commands Gets a collection that contains the commands, such as cmdlets, scripts, functions, and aliases, of the initial session state. The host application can use this collection to add commands to the session state. This property is introduced in Windows PowerShell 2.0.
public property DisableFormatUpdates Gets or sets a value that indicates whether updates to the format table are disabled. This includes disabling format table updates through Windows PowerShell cmdlets such as Update-FormatData and Import-Module.
public property Formats Gets a collection that contains the formatting files of the initial session state. The host application can use this collection to add formatting files to the session state. Formatting files define how .NET Framework objects are displayed by Windows PowerShell. This property is introduced in Windows PowerShell 2.0.
public property LanguageMode Gets and sets the language mode for runspaces that are opened by using this initial session state. For example, if the language mode is restricted then the runspace will be opened in restricted language mode. This property is introduced in Windows PowerShell 2.0.
public property Modules Gets the list of modules that can be used to load the default cmdlets, providers, etc., of an initial session state.
public property Providers Gets a collection that contains the providers of the initial session state. The host application can use this collection to add providers to the session state. This property is introduced in Windows PowerShell 2.0.
public property ThreadOptions Gets and sets a thread option that identifies whether a new thread is created each time a command is run. This property is introduced in Windows PowerShell 2.0.
public property ThrowOnRunspaceOpenError Gets and sets a Boolean value that indicates whether an exception is thrown while opening the runspace. This property is introduced in Windows PowerShell 2.0.
public property Types Gets a collection that contains the type files of the initial session state. The host application can use this collection to add type files to the session state. Type files are used to extend the .NET Framework types that are used by commands. This property is introduced in Windows PowerShell 2.0.
public property UseFullLanguageModeInDebugger Gets and sets a Boolean value that indicates whether the Windows PowerShell debugger will use FullLanguage mode while troubleshooting scripts.This property is introduced in Windows PowerShell 2.0.
public property Variables Gets a collection that contains the variables of the initial session state. The host application can use this collection to add variables to the session state. This property is introduced in Windows PowerShell 2.0.
Top
(see also Protected Methods)
 NameDescription
public methodCloneCreates an exact copy of the current InitialSessionState object. This method is introduced in Windows PowerShell 2.0.
public methodstaticCreateOverloaded. Creates an InitialSessionState object. The variants of this method can create an InitialSessionState object that is empty, that specifies a snap-in or snap-in collection, and that specifies a snap-in collection and warning exception. This method is introduced in Windows PowerShell 2.0.
public methodstaticCreateDefaultCreates an InitialSessionState object that contains the default commands provided by Windows PowerShell. This method is introduced in Windows PowerShell 2.0.
public methodstaticCreateDefault2Creates a default Windows PowerShell session with the default cmdlets, providers, etc., that are loaded by the modules listed in the Modules property. This method was introduced in Windows PowerShell version 3.0.
public methodstaticCreateFromOverloaded. Creates an InitialSessionState object from one or more snap-ins. The variants of this method can create the object from a single snap-in located at a specified path, or from a set of snap-ins located at several paths. This method is introduced in Windows PowerShell 2.0.
public methodstaticCreateRestrictedCreates an InitialSessionState object that can be used to create sessions whose Windows PowerShell commands are restricted based on the capabilities of the session. This method is introduced in Windows PowerShell 2.0.
public methodEquals  (Inherited from Object)
public methodGetHashCode  (Inherited from Object)
public methodGetType  (Inherited from Object)
public methodImportPSModuleAdds a list of modules to the initial session state. These modules are imported into the runspace when it is opened. This method is introduced in Windows PowerShell 2.0.
public methodImportPSModulesFromPathImports all Windows PowerShell modules from a module path by default.
public methodImportPSSnapInAdds 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.
public methodToString  (Inherited from Object)
Top
  Name Description
protected method Finalize  (Inherited from Object)
protected method MemberwiseClone  (Inherited from Object)
Top

Send comments about this topic to Microsoft.
Show:
© 2014 Microsoft. All rights reserved.