我正在尝试实现一个远程运行空间,它需要connectionInfo与Exchange通信,导入模块需要与活动目录通信.这是问题代码:
runspace = System.Management.Automation.Runspaces.RunspaceFactory. CreateRunspace(psConnectionInfo); runspace.InitialSessionState.ImportPSModule(new[] { "ActiveDirectory" }); runspace.Open();
我得到的运行时错误是:
无法执行操作,因为操作"文件中的偏移32处的NewNotImplementedException:line:column:0:0"未实现
如果我省略该runspaceInitialSessionState
行,则不会收到错误但是SetADServerSettings
ViewEntireForest 的PowerShell命令无法运行,因为它无法识别.
堆栈跟踪:
无法执行操作,因为未实现操作"文件中的偏移32处的NewNotImplementedException:line:column:0:0".在System.Management.Automation.RemoteRunspace.get_InitialSessionState()位于c:\ Users\rtanner.CATNET\Documents\Visual Studio 2013\Projects\ManageUserForwardsWS\ManageUserForwardsWS\ManageUserForwards.asmx中的ManageUserForwardsWS.ManageUserForwards.SetExchangeCredentials(String userName,String PwString) .cs:第122行
我也可以使用此代码生成相同的错误:
Pipeline pipeline = runspace.CreatePipeline(); PowerShell powershell = PowerShell.Create(); powershell.Runspace = pipeline.Runspace; powershell.Runspace.InitialSessionState.ImportPSModule(new[] { "ActiveDirectory" });
这是StackTrace:
无法执行操作,因为未实现操作"文件中的偏移32处的NewNotImplementedException:line:column:0:0".在System.Management.Automation.RemoteRunspace.get_InitialSessionState()位于c:\ Users\rtanner.CATNET\Documents\Visual Studio 2013\Projects\ManageUserForwardsWS\ManageUserForwardsWS\ManageUserForwards.asmx中的ManageUserForwardsWS.ManageUserForwards.SetForward(String sAMAccountName,String fowardAddress) .cs:第151行
这个附加信息有帮助吗?有想法该怎么解决这个吗?