Exchange と通信するための connectionInfo と Active Directory と通信するためのインポートされたモジュールの両方を必要とするリモート実行空間を実装しようとしています。問題のコードは次のとおりです。
runspace = System.Management.Automation.Runspaces.RunspaceFactory.
CreateRunspace(psConnectionInfo);
runspace.InitialSessionState.ImportPSModule(new[] { "ActiveDirectory" });
runspace.Open();
私が得る実行時エラーは次のとおりです。
操作「NewNotImplementedException at offset 32 in file:line:column :0:0」が実装されていないため、操作を実行できません
行を省略してrunspaceInitialSessionState
もエラーは発生しませんが、SetADServerSettings
ViewEntireForest への PowerShell コマンドは認識されないため、実行に失敗します。
スタックトレース:
操作 "NewNotImplementedException at offset 32 in file:line:column :0:0 " が実装されていないため、操作を実行できません。c:\Users\rtanner.CATNET\Documents\Visual Studio 2013\Projects\ManageUserForwardsWS\ManageUserForwardsWS\ManageUserForwards.asmx の ManageUserForwardsWS.ManageUserForwards.SetExchangeCredentials (文字列 userName、文字列 PwString) で System.Management.Automation.RemoteRunspace.get_InitialSessionState() で.cs:122行目
代わりに、次のコードで同じエラーを生成することもできます。
Pipeline pipeline = runspace.CreatePipeline();
PowerShell powershell = PowerShell.Create();
powershell.Runspace = pipeline.Runspace;
powershell.Runspace.InitialSessionState.ImportPSModule(new[] { "ActiveDirectory" });
そして、ここにスタックトレースがあります:
操作「NewNotImplementedException at offset 32 in file:line:column :0:0」が実装されていないため、操作を実行できません。c:\Users\rtanner.CATNET\Documents\Visual Studio 2013\Projects\ManageUserForwardsWS\ManageUserForwardsWS\ManageUserForwards.asmx の ManageUserForwardsWS.ManageUserForwards.SetForward (文字列 sAMAccountName、文字列 fowardAddress) で System.Management.Automation.RemoteRunspace.get_InitialSessionState() で.cs:151行目
この追加情報は役に立ちますか? これを修正する方法についてのアイデアはありますか?