Export (0) Print
Expand All

WSManConnectionInfo Class

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)

'Usage
Dim instance As WSManConnectionInfo

public sealed class WSManConnectionInfo : RunspaceConnectionInfo
public final class WSManConnectionInfo extends RunspaceConnectionInfo
public final class WSManConnectionInfo extends RunspaceConnectionInfo

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;
        }

This class cannot be inherited.


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

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:
© 2015 Microsoft