![](/img/trans.png)
[英]The term 'Connect-AzureAD' is not recognized as the name of a cmdlet
[英]The term 'connect-QADService' is not recognized as the name of a cmdlet… inside C# 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();
導致以下錯誤
術語“ connect-QADService”不被視為cmdlet,函數,腳本文件或可運行程序的名稱。 檢查名稱的拼寫,或者是否包含路徑,請驗證路徑是否正確,然后重試。
安裝ActiveRoles cmdlet並成功在Power Shell中運行等效命令后。 我會在項目引用中錯過一些dll嗎? 謝謝
默認情況下,Quest ActiveRoles cmdlet不會加載到PowerShell會話中,因為它們不是PowerShell的一部分。
PowerShell 3將在需要時自動加載模塊。 我不知道在使用RunSpace時是否適用,因為我從未以這種方式使用過PowerShell。
您是否在PowerShell配置文件中加載Quest管理單元或模塊? 您需要在C#代碼中執行等效操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.