????C#??Lync Server????
???????????? ???????[ 2013/7/29 10:33:17 ] ????????
?????????????Lync Server?????????C#????Lync???????????????????????????????
????Lync????????????????????????????????????ó??????IIS????????ó????????
????Lync Server Internal Web Site?±??OcsPowershell????????????????????????????Lync?????????й???????????WebService??????????????????????????????????
????1??????System.Management.Automation.dll
????????????????dll????????C:Program FilesReference AssembliesMicrosoftWindowsPowerShellv1.0System.Management.Automation.dll?????????????????Power Shell????е??
????2????????????п??
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Management.Automation.Host;
public class RemoteRunspace : IRunspace
{
public Runspace CreateRunspace()
{
//Lync????webservice???
String uri = "https://????????/OcsPowerShell";
//???????uri
String shellUri = http://schemas.microsoft.com/powershell/Microsoft.Powershell;
//???????
String userName = "xxx";
//????????
String userPwd = "xxx";
Char[] userPwds = userPwd.ToCharArray();
SecureString secPwd = new SecureString();
foreach (Char c in userPwds)
{
secPwd.AppendChar(c);
}
RunspaceConfiguration config = RunspaceConfiguration.Create();
WSManConnectionInfo connInfo = new WSManConnectionInfo(new Uri(uri)?? shellUri?? new PSCredential(userName?? secPwd));
Runspace runspace = RunspaceFactory.CreateRunspace(connInfo);
try
{
runspace.Open();
Console.WriteLine("????Remote Runspace?????");
return runspace;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
return null;
}
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11