InitialSessionState InitialSessionState InitialSessionState Class


Allows you to define the set of elements that should be present when Session State is created.

public class InitialSessionState
type InitialSessionState = class
Public Class InitialSessionState


InitialSessionState() InitialSessionState() InitialSessionState()

ctor for Custom-Shell - Do we need this?


ApartmentState ApartmentState ApartmentState

ApartmentState of the thread used to execute commands

Assemblies Assemblies Assemblies

The list of assemblies to load...

AuthorizationManager AuthorizationManager AuthorizationManager

Specifies the authorization manager to be used for this session state instance. If no authorization manager is specified, then the default authorization manager for PowerShell will be used which checks the ExecutionPolicy before running a command.

Commands Commands Commands

List of commands (Alias, Application, Cmdlets, Function, Script) for this entry.

DisableFormatUpdates DisableFormatUpdates DisableFormatUpdates

If set to true, disables any updates to format table. This includes disabling format table updates through Update-FormatData, Import-Module etc. All the disabling happens silently ie., the user will not get any exception. By default, this is set to False.

EnvironmentVariables EnvironmentVariables EnvironmentVariables
ExecutionPolicy ExecutionPolicy ExecutionPolicy

Specifies the execution policy to be used for this session state instance

Formats Formats Formats
LanguageMode LanguageMode LanguageMode

Specifies the language mode to be used for this session state instance

Modules Modules Modules

Imported modules.

Providers Providers Providers
StartupScripts StartupScripts StartupScripts
ThreadOptions ThreadOptions ThreadOptions

This property determines whether a new thread is create for each invocation of a command

ThrowOnRunspaceOpenError ThrowOnRunspaceOpenError ThrowOnRunspaceOpenError

If this property is set and there was a runspace creation error, then throw an exception, otherwise just continue creating the runspace even though it may be in an inconsistent state.

TranscriptDirectory TranscriptDirectory TranscriptDirectory

Specifies the directory to be used for collection session transcripts

Types Types Types

List of types to use for this session state instance...

UseFullLanguageModeInDebugger UseFullLanguageModeInDebugger UseFullLanguageModeInDebugger

If true the PowerShell debugger will use FullLanguage mode, otherwise it will use the current language mode

Variables Variables Variables


Clone() Clone() Clone()

Clone this InitialSessionState object. The collections are recursively cloned as well as the elements in the collections. Note however, that the contents of the individual entries are not deep-cloned. This is only an issue for variable entries which may have reference types. These objects will be added by reference rather than by value.

Create() Create() Create()

Creates an empty InitialSessionState object...

Create(String) Create(String) Create(String)

Want to get away from SnapIn and console file. Have modules and assemblies instead. Specify the registered SnapIn name or name collection

Create(String[], PSConsoleLoadException) Create(String[], PSConsoleLoadException) Create(String[], PSConsoleLoadException)
CreateDefault() CreateDefault() CreateDefault()

Creates the default PowerShell one with default cmdlets, provider etc. BuiltIn functions, aliases need to be available through default InitialSessionstate constructor. Need to have this discussion for packaging as well.

CreateDefault2() CreateDefault2() CreateDefault2()

Creates the default PowerShell one with default cmdlets, provider etc. The default cmdlets, provider, etc are loaded via Modules For loading Microsoft.PowerShell.Core module only.

CreateFrom(String, PSConsoleLoadException) CreateFrom(String, PSConsoleLoadException) CreateFrom(String, PSConsoleLoadException)
CreateFrom(String[], PSConsoleLoadException) CreateFrom(String[], PSConsoleLoadException) CreateFrom(String[], PSConsoleLoadException)
CreateFromSessionConfigurationFile(String) CreateFromSessionConfigurationFile(String) CreateFromSessionConfigurationFile(String)

Creates an initial session state from a PSSC configuration file

CreateFromSessionConfigurationFile(String, Func<String,Boolean>) CreateFromSessionConfigurationFile(String, Func<String,Boolean>) CreateFromSessionConfigurationFile(String, Func<String,Boolean>)

Creates an initial session state from a PSSC configuration file

CreateRestricted(SessionCapabilities) CreateRestricted(SessionCapabilities) CreateRestricted(SessionCapabilities)

Creates an InitialSessionState instance that exposes only the minimal set of commands needed by give set of sessionCapabilities All commands that are not needed are made private in order to minimize the attack surface.

ImportPSModule(IEnumerable<ModuleSpecification>) ImportPSModule(IEnumerable<ModuleSpecification>) ImportPSModule(IEnumerable<ModuleSpecification>)

Add a list of modules to import when the runspace is created.

ImportPSModule(String[]) ImportPSModule(String[]) ImportPSModule(String[])

Add a list of modules to import when the runspace is created.

ImportPSModulesFromPath(String) ImportPSModulesFromPath(String) ImportPSModulesFromPath(String)

Imports all the modules from the specified module path by default

ImportPSSnapIn(String, PSSnapInException) ImportPSSnapIn(String, PSSnapInException) ImportPSSnapIn(String, PSSnapInException)

Need to have SnapIn support till we move to modules

Applies to