c# - 使用 C# 连接到 SkypeOnlineConnector
问题描述
我想通过 C# 连接到 SkypeOnlineConnector 端点,然后能够执行从端点下载的命令。
类似于为 Exchange 命令建立连接的方式
示例:交换连接
string severName = "ps.outlook.com/PowerShell-LiveID?PSVersion=2.0";
string userName = "name@domain.com";
string password = "Password";
System.Security.SecureString secureString = new System.Security.SecureString();
foreach (char c in password)
secureString.AppendChar(c);
PSCredential credential = new PSCredential(userName, secureString);
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("https://" + severName), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential)
{
AuthenticationMechanism = AuthenticationMechanism.Basic,
SkipCACheck = true,
SkipCNCheck = true,
MaximumConnectionRedirectionCount = 4
};
我试过这个
string PSServerName = "admingb1.online.lync.com/OcsPowershellOAuth";
string UserName = "name@domain.com";
string Password = "password";
System.Security.SecureString secureString = new System.Security.SecureString();
foreach (char c in Password)
secureString.AppendChar(c);
PSCredential credential = new PSCredential(UserName, secureString);
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("https://" + PSServerName), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential)
{
AuthenticationMechanism = AuthenticationMechanism.Basic,
SkipCACheck = true,
SkipCNCheck = true,
MaximumConnectionRedirectionCount = 4
};
运行上面给我以下错误
System.Management.Automation.Remoting.PSRemotingTransportException : Connecting to remote server admingb1.online.lync.com failed with the following error message : The WinRM client cannot process the request. The authentication mechanism requested by the client is not supported by the server or unencrypted traffic is disabled in the service configuration. Verify the unencrypted traffic setting in the service configuration or specify one of the authentication mechanisms supported by the server. To use Kerberos, specify the computer name as the remote destination. Also verify that the client computer and the destination computer are joined to a domain. To use Basic, specify the computer name as the remote destination, specify Basic authentication and provide user name and password. Possible authentication mechanisms reported by server: For more information, see the about_Remote_Troubleshooting Help topic.
这是正确的做法还是需要完全不同的方法?
任何帮助,将不胜感激。
解决方案
推荐阅读
- sql - SQL Server - 案例
- server - 在 VB6 中,如何使用 FilesSystemObject 访问多个服务器上的目录?
- angular - 当我手动选择帐户时,带有 GoogleAuthProvider 的 signInWithRedirect 在 safari 上出现白屏
- swift - 使用 IBOutlet 连接 MapKit 视图时应用程序崩溃
- npm - 运行 npm install 时出错
- maven - Intellij 在实际没有错误时报告依赖错误
- c# - Xamarin 插件地理定位器不适用于 Xamarin Forms android
- algorithm - 给定一个包含两个整数作为节点的查询,在树中找到这两个节点的所有子节点?
- spring - 使用spring boot默认杰克逊映射时日期时区发生变化
- html - 使用 inline-block 时 div 消失