コマンドレットを実行するためにオンラインで Exchange のリモート Powershell 接続を開く必要がある C# で .Net コンポーネントを作成しています。ただし、ローカル マシンとインターネットの間には Web プロキシ サーバーがあります。IE でプロキシ サーバーの設定を提供していません。リモート ランスペースを開くときに、どうにかして Web プロキシ サーバーの IP アドレスとポート番号を提供する必要があります。
私は次のコードを使用しています:
PSCredential credential = new PSCredential(userEmail, securePassword);
connectionInfo = new WSManConnectionInfo(new Uri("https://ps.outlook.com/powershell"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential);
connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
connectionInfo.MaximumConnectionRedirectionCount = 2;
runspace = RunspaceFactory.CreateRunspace(connectionInfo);
runspace.Open();
powershell.Runspace = runspace;
//Create the command and add a parameter
powershell.AddCommand("Get-MailboxFolderStatistics");
powershell.AddParameter("identity", sMailbox);
...
...
...
pipeline = remoteRunspace.CreatePipeline()
foreach (Command command in cmdlet.GetCommands())
{
pipeline.Commands.Add(command);
}
commandResults = pipeline.Invoke();
Runspace オブジェクトの RunspaceconnectionInfo の ProxyAccessType、ProxyCredentials、ProxyAuthentication プロパティには何を指定すればよいですか。
IE でプロキシ設定を使用せずに Web プロキシ サーバー設定を提供することで、リモート ランタイム空間を開く方法はありますか。アプリケーションのユーザー インターフェイスを介して、プロキシ サーバーの IP とポートを API に渡したい
提案してください。
ありがとう、ガガン