【问题标题】:The term 'Get-CsUser' is not recognized as the name of a cmdlet, function, script file, or operable program术语“Get-CsUser”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称
【发布时间】:2014-01-10 07:01:10
【问题描述】:

如果运行 lync powershell 命令“Get-CsUser”,我会遇到异常。我正在使用管理员和具有 lync powershell 的机器上运行应用程序。

System.Management.Automation.CommandNotFoundException:术语 'Get-CsUser' 未被识别为 cmdlet、函数的名称, 脚本文件或可运行的程序。检查名称的拼写,或 如果包含路径,请验证路径是否正确并重试。 在 System.Management.Automation.CommandDiscovery.LookupCommandInfo(字符串 commandName, CommandOrigin commandOrigin) 在 System.Management.Automation.CommandDiscovery.LookupCommandProcessor(字符串 commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
在 System.Management.Automation.Runspaces.Command.CreateCommandProcessor(ExecutionContext executionContext, CommandFactory commandFactory, Boolean addToHistory) 在 System.Management.Automation.Runspaces.LocalPipeline.CreatePipelineProcessor() 在 System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper() 在 System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()

示例代码:

using (Runspace runspace = RunspaceFactory.CreateRunspace(initial))
{

            //// open it
            runspace.Open();


            using (PowerShell ps = PowerShell.Create())
            {
                ps.Runspace = runspace;
                ps.AddScript("import-module 'C:\\Program Files\\Common Files\\Microsoft 
                ps.AddCommand("Get-CsUser");
                Collection<PSObject> results = ps.Invoke();
                foreach (PSObject obj in results)
                {
                    stringBuilder.AppendLine(obj.ToString());
                }
                runspace.Close();
            }
}

有什么建议可以解决这个问题???

【问题讨论】:

标签: c# powershell lync


【解决方案1】:

我没有答案,但有一系列 4 篇文章描述了使用 Lync powershell cmdlet 和 C#。例如,这里是其中一篇文章的链接:

PowerShell Scripting Lync 2010 SDK Using Lync Model API

全套四篇文章发表在这里:

Lync 2010 Technical Articles

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-09
    • 2022-07-30
    • 2021-11-01
    • 2021-05-23
    • 2020-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多