简体   繁体   English

在C#函数中,术语'connect-QADService'不被识别为cmdlet的名称。

[英]The term 'connect-QADService' is not recognized as the name of a cmdlet… inside C# function

Can someone, please, help to understand why the following code inside a Csharp function 有人可以帮忙理解为什么Csharp函数中包含以下代码的原因

    Runspace runspace = RunspaceFactory.CreateRunspace();
    runspace.Open();
    Pipeline pipe = runspace.CreatePipeline();
    Command connectToActDir = new Command("connect-QADService");
    connectToActDir.Parameters.Add("Service", "'ip:port'");
    connectToActDir.Parameters.Add("ConnectionAccount", "'user.local\administrator'");
    connectToActDir.Parameters.Add("ConnectionPassword", "'password'");
    pipe.Commands.Add(connectToActDir);
    pipe.Invoke();

causes the following error 导致以下错误

The term 'connect-QADService' is not recognized as the name of a cmdlet, function, script file, or operable program. 术语“ connect-QADService”不被视为cmdlet,函数,脚本文件或可运行程序的名称。 Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 检查名称的拼写,或者是否包含路径,请验证路径是否正确,然后重试。

while ActiveRoles cmdlets are installed and running the equivalent command in power shell succeeds. 安装ActiveRoles cmdlet并成功在Power Shell中运行等效命令后。 Do I miss some dll in project references? 我会在项目引用中错过一些dll吗? Thanks 谢谢

The Quest ActiveRoles cmdlets are not loaded into a PowerShell session by default, because they're not part of PowerShell. 默认情况下,Quest ActiveRoles cmdlet不会加载到PowerShell会话中,因为它们不是PowerShell的一部分。

PowerShell 3 will automatically load modules when needed. PowerShell 3将在需要时自动加载模块。 I don't know if this holds true when using a RunSpace as I've never used PowerShell this way. 我不知道在使用RunSpace时是否适用,因为我从未以这种方式使用过PowerShell。

Do you load the Quest snap-in or module in your PowerShell profile? 您是否在PowerShell配置文件中加载Quest管理单元或模块? You'll need to do the equivalent in your C# code. 您需要在C#代码中执行等效操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 术语“Connect-AzureAD”未被识别为 cmdlet 的名称 - The term 'Connect-AzureAD' is not recognized as the name of a cmdlet 术语''不被识别为cmdlet的名称, - The term ' ' is not recognized as the name of a cmdlet, 该术语未被识别为 cmdlet、函数、脚本文件或可运行程序的名称 - the term is not recognized as the name of a cmdlet, function, script file, or operable program 术语“Add-AzureAccount”未被识别为cmdlet,函数,脚本文件的名称 - The term 'Add-AzureAccount' is not recognized as the name of a cmdlet, function, script file 术语“ New-CsOnlineSession”不被视为cmdlet的名称 - The term 'New-CsOnlineSession' is not recognized as the name of a cmdlet 术语“add-migration”未被识别为 cmdlet 的名称 - The term 'add-migration' is not recognized as the name of a cmdlet 术语“livingdoc”未被识别为 cmdlet、function、脚本文件或可运行程序的名称。 检查名字的拼写,或者如果 - The term 'livingdoc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if 术语“ Get-CsUser”不能识别为cmdlet,函数,脚本文件或可运行程序的名称 - The term 'Get-CsUser' is not recognized as the name of a cmdlet, function, script file, or operable program 术语“添加编号”不被视为cmdlet,函数,脚本文件或可运行程序的名称 - The term 'Add-Number' is not recognized as the name of a cmdlet, function, script file, or operable program “'add-migration' 一词未被识别为 cmdlet 的名称”Visual Studio 2019 - “the term 'add-migration' is not recognized as the name of a cmdlet” visual studio 2019
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM