に私は、次のC#コード内_Get-User -Identity "John Doe" | FL_
コマンドを実行しようとしています。は、PowerShellコマンドを実行します(-Identity「ジョン・ドウ」ユーザーを取得| FL)をC#の
PowerShell powershell = PowerShell.Create();
powershell.AddCommand("get-user");
powershell.AddParameter("Identity", UserName.Text);
try
{
runspace.Open();
powershell.Runspace = runspace;
Collection<PSObject> results = powershell.Invoke();
var builder = new StringBuilder();
foreach (var psObject in results)
{
builder.AppendLine(psObject.ToString() + "\r\n");
}
ResultBox.Text = Server.HtmlEncode(builder.ToString());
}
ここで、_FL_
コマンドを追加しますか?
「結果」を「FL」(別のPowershellコマンド)に渡すことはありませんか?あるいは、完全なコマンド文字列を使用できますか? –