[英]Executing standard PowerShell cmdlets in remote session to Lync
Having an odd issue over here. 这里有一个奇怪的问题。 I'm able to start a remote session from my C# application to PowerShell in a Lync Server 2010 instance. 我可以启动从C#应用程序到Lync Server 2010实例中的PowerShell的远程会话。 I'm able to get all the Lync-specific cmdlets and execute them, but if I try to do something with a standard cmdlet — in my case "get-content" in order to convert a file to a byte array — it will not recognize the command. 我可以获取所有Lync特定的cmdlet并执行它们,但是如果我尝试使用标准cmdlet进行操作(在我的情况下为“ get-content”,以便将文件转换为字节数组),则不会识别命令。
Is there a way/need to load the standard PS set of cmdlets into that session? 是否有办法将标准PS cmdlet集加载到该会话中? It feels like I'm missing something here... 感觉我在这里想念什么...
Thanks in advance! 提前致谢!
N ñ
EDIT: Here's a code snippet of what I have going on... 编辑:这是我正在进行的代码片段...
PSCredential creds = new PSCredential(lyncUser, lyncPW);
WSManConnectionInfo conn = new WSManConnectionInfo(new Uri(lyncURI), schema, creds);
conn.AuthenticationMechanism = AuthenticationMechanism.Default;
Runspace rs = RunspaceFactory.CreateRunspace(conn);
rs.Open();
List<FileInfo> files = getWavFiles();
foreach (var file in files)
{
Pipeline lyncCommands = rs.CreatePipeline();
Command getContent = new Command("Get-Content");
getContent.Parameters.Add(file.FullName);
getContent.Parameters.Add("readcount", 0);
getContent.Parameters.Add("encoding", "byte");
lyncCommands.Commands.Add(getContent);
Command importAnnouncement = new Command("import-csannouncementfile");
importAnnouncement.Parameters.Add("parent", "applicationserver:myserver.mydomain.mycom");
importAnnouncement.Parameters.Add("filename", file.Name);
importAnnouncement.Parameters.Add("force");
lyncCommands.Commands.Add(importAnnouncement);
foreach (PSObject r in lyncCommands.Invoke())
{
Console.WriteLine(r.ToString() + Environment.NewLine);
}
}
The "import-csannouncement" part will work just fine... it's "get-content" part that gets dicey... “ import-csannouncement”部分将正常工作...它的“ get-content”部分非常有用...
You can try re-configuring the LYNC server remote sessions for Full Language mode. 您可以尝试将LYNC服务器远程会话重新配置为“全语言”模式。
(Link is about configuring for Exchange servers, but I believe it's the same issue) (链接是关于为Exchange服务器配置的,但我相信这是相同的问题)
http://blog.mimecast.com/2011/08/get-full-control-over-your-exchange-remote-powershell-session/ http://blog.mimecast.com/2011/08/get-full-control-over-your-exchange-remote-powershell-session/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.