Windows desktop applications
Collapse the table of content
Expand the table of content
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.

WSManConnectionInfo.ShellUri Property


Updated: April 27, 2016

Applies To: Windows PowerShell

Gets or sets the uniform resource identifier (URI) of the shell that is launched when the connection is made. This property is introduced in Windows PowerShell 2.0.

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

public string ShellUri { get; set; }

Property Value

Type: System.String

A String that contains the URI of the shell that is launched when the connection is made.

This property is set when the WSManConnectionInfo object is created.

The following code sample uses ShellUri to set the URI for the Windows PowerShell, and then create runspace pool.

private void PerformWork(ActivityActionData data)
    bool failed = false;
    Exception exception = null;

        // setting up the streams
        data.command.Streams.Debug = data.streams.DebugStream;
        data.command.Streams.Error = data.streams.ErrorStream;
        data.command.Streams.Progress = data.streams.ProgressStream;
        data.command.Streams.Verbose = data.streams.VerboseStream;
        data.command.Streams.Warning = data.streams.WarningStream;

        // Custom WinRM Workflow Endpoint details
        // run CustomWorkflowEndpointSetup.ps1 in Powershell console as administrator, if you have not done.
        WSManConnectionInfo connectionInfo = new WSManConnectionInfo();
        connectionInfo.ShellUri = "";                

        // Create runspace pool on custom workflow endpoint where command will be invoked
        using (RunspacePool r = RunspaceFactory.CreateRunspacePool(1, 1, connectionInfo))
                data.command.RunspacePool = r;

                // now executing the powershell command.
                data.command.Invoke(data.streams.InputStream, data.streams.OutputStream, new PSInvocationSettings());
Return to top

Community Additions

© 2016 Microsoft