InitialSessionState.CreateDefault Method

Creates an InitialSessionState object that contains the default commands provided by Windows PowerShell. This method is introduced in Windows PowerShell 2.0.


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

'Usage
Dim returnValue As InitialSessionState

returnValue = InitialSessionState.CreateDefault

'Declaration
Public Shared Function CreateDefault As InitialSessionState
public static InitialSessionState CreateDefault ()
public static function CreateDefault () : InitialSessionState

Return Value

Returns an InitialSessionState object that contains the default commands, such as the Get-Help and Get-Command cmdlets.

This example shows how to define an initial session state that adds two variables to an initial session state.

InitialSessionState iss = InitialSessionState.CreateDefault();

Notice that is this example, the CreateDefault constructor is used to create an initial session state that includes the default commands provided by Windows PowerShell.

To create an initial session state that does not include the default commands, call the Create method.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

 

Target Platforms


Show:
© 2014 Microsoft