WSManConnectionInfo Class

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Provides the connection information that is needed to connect to a remote runspace. Windows PowerShell uses a Windows Remote Management (WinRM) connection to connect to the computer where the remote runspace is opened. This class is introduced in Windows PowerShell 2.0.

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

System.Object
  System.Management.Automation.Runspaces.RunspaceConnectionInfo
    System.Management.Automation.Runspaces.WSManConnectionInfo

Public NotInheritable Class WSManConnectionInfo
	Inherits RunspaceConnectionInfo

NameDescription
System_CAPS_pubmethodWSManConnectionInfo()

Initializes a new instance of the WSManConnectionInfo class that connects only to the local computer. This constructor is introduced by Windows PowerShell 2.0.

System_CAPS_pubmethodWSManConnectionInfo(Boolean, String, Int32, String, String, PSCredential)

Initializes a new instance of the WSManConnectionInfo class that contains a value that indicates whether a secure connection such Hypertext Transfer Protocol over Secure Socket Layer (HTTPS) is used, the name of the computer, credentials, and more. This constructor is introduced by Windows PowerShell 2.0.

System_CAPS_pubmethodWSManConnectionInfo(Boolean, String, Int32, String, String, PSCredential, Int32)

Initializes a new instance of the WSManConnectionInfo class that contains a value that indicates whether a secure connection such Hypertext Transfer Protocol over Secure Socket Layer (HTTPS) is used, the maximum allowed time (in milliseconds) for the remote runspace to open, and more. This constructor is introduced by Windows PowerShell 2.0.

System_CAPS_pubmethodWSManConnectionInfo(PSSessionType)

Initializes a new instance of the WSManConnectionInfo class that contains a configuration type. Introduced in Windows PowerShell 3.0.

System_CAPS_pubmethodWSManConnectionInfo(String, String, Int32, String, String, PSCredential)

Initializes a new instance of the WSManConnectionInfo class that contains the schema, computer name, port, credentials, and more. This constructor is introduced by Windows PowerShell 2.0.

System_CAPS_pubmethodWSManConnectionInfo(String, String, Int32, String, String, PSCredential, Int32)

Initializes a new instance of the WSManConnectionInfo class that contains the schema, computer name, the maximum allowed time (in milliseconds) for the remote runspace to open, and more. This constructor is introduced by Windows PowerShell 2.0.

System_CAPS_pubmethodWSManConnectionInfo(Uri)

Initializes a new instance of the WSManConnectionInfo class that contains the uniform resource identifier (URI) that defines the connection endpoint. This constructor is introduced by Windows PowerShell 2.0.

System_CAPS_pubmethodWSManConnectionInfo(Uri, String, PSCredential)

Initializes a new instance of the WSManConnectionInfo class that contains the uniform resource identifier (URI) of the connection endpoint, the URI of the shell, and the credentials used to make the connection. This constructor is introduced by Windows PowerShell 2.0.

System_CAPS_pubmethodWSManConnectionInfo(Uri, String, String)

Initializes a new instance of the WSManConnectionInfo class that contains the Uniform Resource Identifier (URI) of the connection endpoint, the URI of the shell, and a thumbprint of the certificate used to make the connection. This constructor is introduced by Windows PowerShell 2.0.

NameDescription
System_CAPS_pubpropertyAppName

Gets or sets the application name for the endpoint on the remote computer. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyAuthenticationMechanism

Gets or sets the type of authentication mechanism used to create a PSSession using this connection, such as Credential Security Service Provider (CredSSP) authentication. This property is introduced in Windows PowerShell 2.0.(Overrides RunspaceConnectionInfo.AuthenticationMechanism.)

System_CAPS_pubpropertyCancelTimeout

Gets and sets the maximum allowed time (in milliseconds) that Windows PowerShell will wait before it times due to a cancel operations, such as closing the runspace or stopping Windows PowerShell. (Inherited from RunspaceConnectionInfo.)

System_CAPS_pubpropertyCertificateThumbprint

Gets or sets the thumbprint of the digital public key certificate (X509) used to make the connection. This property is introduced in Windows PowerShell 2.0.(Overrides RunspaceConnectionInfo.CertificateThumbprint.)

System_CAPS_pubpropertyComputerName

Gets or sets the name of the computer where the remote runspace is opened. This property is introduced in Windows PowerShell 2.0.(Overrides RunspaceConnectionInfo.ComputerName.)

System_CAPS_pubpropertyConnectionUri

Gets or sets the uniform resource identifier (URI) that defines the connection endpoint. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyCredential

Gets or sets the user account that has permission to make the connection. This property is introduced in Windows PowerShell 2.0.(Overrides RunspaceConnectionInfo.Credential.)

System_CAPS_pubpropertyCulture

Gets and sets the culture that is used when running commands in the remote runspace.(Inherited from RunspaceConnectionInfo.)

System_CAPS_pubpropertyEnableNetworkAccess

Specifies the maximum number of connection retries if previous connection attempts fail due to network issues. Introduced in Windows PowerShell 3.0.

System_CAPS_pubpropertyIdleTimeout

Gets and sets the amount of time (in milliseconds) that Windows PowerShell will wait for an idle operation to complete.(Inherited from RunspaceConnectionInfo.)

System_CAPS_pubpropertyIncludePortInSPN

Gets or sets a value that indicates whether to use the service principal name (SPN) along with the port number during authentication. Introduced in Windows PowerShell 3.0.

System_CAPS_pubpropertyMaxConnectionRetryCount

Specifies the maximum number of connection retries if previous connection attempts fail due to network issues.

This element is introduced in Windows PowerShell 5.0.

System_CAPS_pubpropertyMaxIdleTimeout

The maximum allowed idle timeout duration (in ms) that can be set on a Runspace. This is a read-only property that is set once the Runspace is successfully created and opened.

This element is introduced in Windows PowerShell 5.0.(Inherited from RunspaceConnectionInfo.)

System_CAPS_pubpropertyMaximumConnectionRedirectionCount

Get or sets the maximum number of times that universal resource identifier (URI) redirection is allowed for this connection. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyMaximumReceivedDataSizePerCommand

Gets or sets the maximum amount of data, in bytes, that can be received using this connection. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyMaximumReceivedObjectSize

Gets or sets the maximum size, in bytes, of a deserialized object that can be received from using this connection. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyNoEncryption

Gets or sets a value that indicates whether data encryption is used.

System_CAPS_pubpropertyNoMachineProfile

Gets or sets a value that indicates whether the Windows profile of the user is loaded.

System_CAPS_pubpropertyOpenTimeout

Gets and sets the maximum amount of time (in milliseconds) that Windows PowerShell will wait for an open operation to complete.(Inherited from RunspaceConnectionInfo.)

System_CAPS_pubpropertyOperationTimeout

Gets and sets the amount of time (in milliseconds) that Windows PowerShell will wait for an operation to complete.(Inherited from RunspaceConnectionInfo.)

System_CAPS_pubpropertyOutputBufferingMode

Gets or sets how a server in disconnected state deals with cached output data if the cache becomes filled. Introduced in Windows PowerShell 3.0.

System_CAPS_pubpropertyPort

Gets or sets the number of the port used to make the remote connection.

System_CAPS_pubpropertyProxyAccessType

Gets or sets the mechanism that is used to resolve the host name.

System_CAPS_pubpropertyProxyAuthentication

Gets or sets the authentication method that is used for proxy resolution.

System_CAPS_pubpropertyProxyCredential

Gets or sets the credentials used to make the connection on the computer.

System_CAPS_pubpropertyScheme

Gets or sets the scheme used to make the connection.

System_CAPS_pubpropertyShellUri

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.

System_CAPS_pubpropertySkipCACheck

Gets or sets a value that indicates whether, when connecting over Hypertext Transfer Protocol over Secure Socket Layer (HTTPS), the client does not validate that the server certificate is signed by a trusted certificate authority (CA).

System_CAPS_pubpropertySkipCNCheck

Gets or sets a value that indicates whether the client validates that the certificate common name (CN) of the server matches the hostname of the server.

System_CAPS_pubpropertySkipRevocationCheck

Gets or sets a value that indicates whether the connection does not validate the revocation status of the server certificate.

System_CAPS_pubpropertyUICulture

Gets and sets the UI culture that is used when running commands in the remote runspace.(Inherited from RunspaceConnectionInfo.)

System_CAPS_pubpropertyUseCompression

Gets or sets a value that indicates whether the Web Services for Management (WSMan) protocol infrastructure compresses the data sent over the network. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyUseUTF16

Gets or sets a value that indicates whether the UTF-16 format or the UTF-8 format is used when encoding requests.

NameDescription
System_CAPS_pubmethodCopy()

Creates a WSManConnectionInfo object that is the same as the current WSManConnectionInfo object. This method is introduced in Windows PowerShell 2.0.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodSetSessionOptions(PSSessionOption)

Sets the advanced options for the session. Introduced in Windows PowerShell 3.0.(Overrides RunspaceConnectionInfo.SetSessionOptions(PSSessionOption).)

System_CAPS_pubmethodToString()

(Inherited from Object.)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticHttpScheme

Specifies the Hypertext Transfer Protocol (HTTP) scheme. This field is constant. Introduced in Windows PowerShell 3.0.

System_CAPS_pubfieldSystem_CAPS_staticHttpsScheme

Specifies the Hypertext Transfer Protocol over Secure Socket Layer (HTTPS) scheme. This field is constant. Introduced in Windows PowerShell 3.0.

This class cannot be inherited.

The following code example describes how to connect to a remote runspace using WSManConnectionInfo.

public void openRunspace(string uri, string schema, string username, string livePass)
        {
            System.Security.SecureString password = new System.Security.SecureString();
            foreach (char c in livePass.ToCharArray())
            {
                password.AppendChar(c);
            }
            PSCredential psc = new PSCredential(username, password);
            WSManConnectionInfo rri = new WSManConnectionInfo(new Uri(uri), schema, psc);
            rri.AuthenticationMechanism = AuthenticationMechanism.Basic;
            Runspace runspace = RunspaceFactory.CreateRunspace(rri);
            runspace.Open();
            Application["runspace"] = runspace;
        }

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

Return to top
Show: