Windows SCOM:重新计算监视状态()问题
脚本出现问题,试图通过powershell脚本重新计算SCOM中的信息。重新计算时遇到问题Windows SCOM:重新计算监视状态()问题,windows,powershell,scom,Windows,Powershell,Scom,脚本出现问题,试图通过powershell脚本重新计算SCOM中的信息。重新计算时遇到问题 #imput parameters Param( [Parameter(Mandatory=$False)] [string[]]$computerName ) Import-Module OperationsManager #Main SCOM server var $computerName = "SCOMserver" #Connect to the SCOM-Mgmt Server New-SCO
#imput parameters
Param(
[Parameter(Mandatory=$False)]
[string[]]$computerName
)
Import-Module OperationsManager
#Main SCOM server var
$computerName = "SCOMserver"
#Connect to the SCOM-Mgmt Server
New-SCOMManagementGroupConnection -ComputerName $computerName
#Get all the SCOMalert filtered queue warning state
$alerts = Get-SCOMalert -ComputerName $computerName | Where-Object {$_.Owner -eq “user01” -and $_.ResolutionState -eq “0” -and $_.IsMonitorAlert -eq $true}
Foreach ($ActiveMonitor in $alerts)
{
$ActiveMonitor.recalculatemonitoringstate() | Test-SCOMMonitoringTaskResultForError
}
我得到的错误:
方法调用失败,因为[Microsoft.EnterpriseManagement.Monitoring.MonitoringAllert]不包含名为“RecreacteMonitoringState”的方法。当您遇到类似错误时,值得用谷歌搜索 在本例中,它正确地通知您正在尝试调用此对象没有的方法(
recreactemonitoringstate()
)。退房
此类是相关的,因为您使用的是返回此类型对象的(在变量$alerts
中)
recreactemonitoringstate()
方法是的一部分,因此您可能正在寻找它。您好,谢谢您的回复。(我在powershell中有点慢)从您的回答中我了解到,如果我找到了这两个Get SCOMMonitor和Get SCOMalert之间的界限,就像示例ID一样,可以将Get SCOMalert ID中的数据grep到变量中,并在Get SCOMMonitor中使用重新计算循环它。(此外,我在谷歌上搜索,但很难找到你想要的东西)