- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试通过 Windows Powershell 从远程 Exchange Server 接收所有 TransportAgent 的状态。
我偶尔会收到一个错误, session 状态已损坏
。一旦它被破坏,我需要创建一个新的 session
下面是我正在使用的命令列表(按正确顺序)
# Build the PSSession for Exchange
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<SERVER>/PowerShell/ -Authentication Default
# Invoke the command 'Get-TransportAgent' on the remote PSSession
Invoke-Command $Session {Get-TransportAgent}
# Result when there is NO ERROR
Identity Enabled Priority PSComputerName
-------- ------- -------- --------------
Transport Rule Agent True 1 <SERVER>
Malware Agent True 2 <SERVER>
Text Messaging Routing Agent True 3 <SERVER>
Text Messaging Delivery Agent True 4 <SERVER>
当我重复命令Invoke-Command $Session {Get-TransportAgent}
时,偶尔会发生以下错误:
Invoke-Command : Because the session state for session Session9, <GUID-REMOVED>, <SERVER> is not equal to Open, you cannot run a command in the session. The session state is Broken. At line:1 char:1
更新
在 SessionOption 中添加 IdleTimeout 后,我收到以下错误,然后是 session 已损坏
Invoke-Command $Session {Get-TransportAgent}
Starting a command on the remote server failed with the following error
message : The I/O operation has been aborted because of either a thread exit or an application request. For more information, see the about_Remote_Troubleshooting
Help topic.
+ CategoryInfo : OperationStopped: (<SERVER>:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : JobFailure
+ PSComputerName : <SERVER>
问题:为什么会出现这个错误,如何解决?
最佳答案
您的 session 很可能超时。要进行补救,请创建一个具有增加的 session 超时值的 PSSessionOption
对象,然后您可以将其提供给 New-PSSession
cmdlet。默认超时为 60000 毫秒(1 分钟),如果您正在运行包含异步请求的大量脚本或工作时间很长,则该超时可能非常小。
$so = New-PSSessionOption -IdleTimeout 600000
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<SERVER>/PowerShell/ -Authentication Default -SessionOption $so
此 SessionOption
对象将使您的 $session
在上次命令执行后保持打开状态 10 分钟。
编辑:阅读有关 Powershell 远程 session 状态的手册后,我发现 Broken
是一种异常状态,它不是由空闲或其他本地操作引起的,而是由相反,这表明所涉及的主机之间失去连接,或者在服务器端运行“wsmprovhost”出现问题。您应该调查您的操作系统和网络是否健康。脚本仍然可以处理此类错误,为此,您应该检查 session 状态,如果不是已打开
,请重新打开 session 。
if ($session.state -ne "Opened") {
Write-Host "The session went into $($session.state) state! Reinitializing!"
$session=New-PSSession <arguments skipped>
}
不过,如果重新连接尝试会引发超时,那么请退出脚本,因为在没有连接的情况下您无法真正进行任何远程处理。
关于powershell - Exchange Remote Powershell 出现零星 'Broken' 状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30617304/
有没有办法使用 EWS Managed API 搜索 Exchange 以查找所有文件夹中的所有电子邮件。我正在使用 FindItems API 调用——但这似乎要求将搜索限制在单个文件夹中。
我已经看到这个问题被问了好几次,但到目前为止,答案都非常机械化和令人失望: EWS 与 EAS 有什么区别? 现在,大多数网站都给出以下内容:“一个是移动设备协议(protocol),另一个是 Web
我们将 Exchange 集成到我们的 CRM(日记和电子邮件)中;我们通过 SQL 2008 服务器中的 CRL 函数完成了这项工作,这些函数处理所有身份验证以及与 Exchange 2007 We
我想为交换服务器创建插件。 Exchange 服务器是否为此提供任何 SDK。如果有人知道,请告诉我。 最佳答案 此链接应为您提供可用内容的概览。 https://msdn.microsoft.com
我刚开始使用EWS(Exchange Web服务),并且正在寻找一个简单的示例,该示例演示如何发送带有附件的电子邮件。我搜索了一个示例,但找不到简单明了的示例。我找到了有关如何发送电子邮件但不发送带有
我在一个客户站点工作,并通过网络邮件连接到他们的 Exchange 2000 服务器。我正在运行 Outlook 2007,并通过 HTTP 连接到我的公司 Exchange 2007。 是否有任何方
从 Exchange 2007 开始,安装 Exchange 时不再安装 MAPI。在这些系统上 this install如果您想使用 MAPI,则除 Exchange 外还需要。 我的软件依赖于 E
交换 2010。 我已经阅读了有关 Exchange 中的通知订阅、邮箱事件和 EWS 的信息,据我所知,通知客户端应用程序必须始终与 EWS 保持连接。我对吗? 我的任务看起来很简单 - 当消息到达
我试图弄清楚节流政策如何影响 EWS。 对于 EWS,我们有以下值: EWSMaxSubscription:模拟用户完成的事件订阅数。 EWSMaxConcurrency:单个客户端可能执行的并发连接
我在 Exchange 2010 SP2 服务器上使用 EWS 我似乎找不到任何命令/文档来检索交换服务器中所有用户(邮箱/别名)的完整列表 这个问题已经问了好几次了,但我还没有看到任何答案 谢谢 最
我正在使用 CalendarItemType View 来检索日历项目。我唯一关心的项目是我创建的项目,我知道它们都是每周重复出现的项目。我能够获取每个单独的事件,并从其中任何一个中获取重复出现的主项
我从 Exchange 2007 服务器的地址开始: user@domain.exchangeserver.org 我尝试发送自动发现请求,如 MSDN 中所述. 我尝试使用 TechNet Whit
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 12 年前。 Improve thi
这是我所拥有的... 我有一个跟踪条形码类型标签的程序。我可以在数据库中选择一个项目并为它打印一个标签。我正在添加向我们的 Exchange 服务器 (2007 SP1) 上的特定收件箱发送电子邮件并
我的公司正在开发一个桌面和移动电子邮件客户端的项目,该客户端可以连接到不同的邮件服务器,用户或服务器管理员只需进行最少的配置。我们希望能够支持 Exchange,但经过一些研究后我意识到有许多问题需要
我正在尝试调用 GetUserAvailabilityRequest 来自不遵守夏令时的南非标准时间,但是,TimeZone 元素需要 StandardTime 和 DaylightTime 子元素,
我想在我的交换服务器上收到电子邮件时运行脚本。我真的没有关于如何实现这一点的好方向。我已经用 VB 编写了脚本并在 outlook 上对其进行了测试。我错误地认为您可以像在 Outlook 中一样从
我在使用 Exchange 2010 Web 服务 (EWS) 创建全天事件约会时遇到了麻烦。 根据现有要求,创建全天事件约会对象需要指定开始和结束时间(即 10/20/2011 12:00:00 A
是否有任何公共(public) Exchange 服务器(模拟器)可用于测试/试验我的 Exchange Web 服务实现? 最佳答案 我怀疑没有免费的东西。创建自己的 VM 会容易得多。您将需要具有
我正在尝试使用最新的 Exchange Web 服务 DLL,但是当我搜索我的硬盘时,我看到了许多版本的 Microsoft.Exchange.WebServices.DLL,最新的是版本 14.0.
我是一名优秀的程序员,十分优秀!