在 Power Shell 指令碼失敗時發出警示。
PowerShell 無法順利執行。
這可能會影響到某些監視或目錄。
這可能是由以下原因所造成:
指令碼編寫錯誤。
PowerShell 指令碼設定錯誤 (遺失資料項目參照,逾時設定錯誤)。
權限不足,無法存取指令碼使用的資源 (登錄、檔案系統、服務等...)。
資源 (登錄、檔案系統、服務等...) 速度緩慢、離線或處於損毀狀態。
電腦的資源 (如記憶體) 不足以執行該執行檔。
警示描述和內容會提供資訊指出失敗的規則或監視。以下連結將顯示指出執行檔執行失敗的所有事件:
檢視 PowerShell 事件
檢閱其內容中的錯誤後,請檢查:
PowerShell 指令碼在電腦上執行無誤。
PowerShell 指令碼設定正確,而且資料項目參照有效並存在。
動作帳戶能夠存取 PowerShell 指令碼使用的資源。
電腦未過度使用。
將 PowerShell 指令碼儲存至檔案,並透過 PowerShell.exe 執行。
檢查工作管理員以查看可用記憶體是否足夠。
檢查工作管理員以查看有無任何處理序正在耗用所有的 CPU。
另一個錯誤可能是由於執行此指令碼的工作流程設定不當所造成。嵌入式管理單元、參數或逾時秒數設定可能不正確。
Target | Microsoft.SystemCenter.HealthService | ||
Category | Alert | ||
Enabled | True | ||
Alert Generate | True | ||
Alert Severity | Warning | ||
Alert Priority | Normal | ||
Remotable | True | ||
Alert Message |
| ||
Event Log | Operations Manager |
ID | Module Type | TypeId | RunAs |
---|---|---|---|
DS | DataSource | Microsoft.Windows.EventProvider | Default |
GenerateAlert | WriteAction | System.Health.GenerateAlert | Default |
<Rule ID="Microsoft.SystemCenter.PowerShellModule.AlertOnFailedResponses" Enabled="true" Target="SCLibrary!Microsoft.SystemCenter.HealthService" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">
<Category>Alert</Category>
<DataSources>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.EventProvider">
<ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<LogName>Operations Manager</LogName>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Health Service Modules</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Params/Param[1]</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">$Target/ManagementGroup/Name$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<Or>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="UnsignedInteger">EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="UnsignedInteger">22402</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="UnsignedInteger">EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="UnsignedInteger">22406</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="UnsignedInteger">EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="UnsignedInteger">22407</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="UnsignedInteger">EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="UnsignedInteger">22409</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</Or>
</Expression>
</And>
</Expression>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>1</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SystemCenter.PowerShellModule.AlertOnFailedResponses.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue>$Data/EventNumber$</SuppressionValue>
<SuppressionValue>$Data/Params/Param[2]$</SuppressionValue>
<SuppressionValue>$Data/Params/Param[6]$</SuppressionValue>
<SuppressionValue>$Data/Params/Param[8]$</SuppressionValue>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>