1

尝试将服务器设置为 scom 维护模式并收到错误在此处输入图像描述

这是我正在使用的代码:

$Time = ((Get-Date).AddMinutes(240))
Start-SCOMMaintenanceMode -Instance TEST -EndTime $Time -Comment "Applying 
Software Updates."
4

1 回答 1

0

A value for the Instance parameter should have MonitoringObject type. You shall use Get-SCOMClassInstance to retrieve it, but beware, of you use

$Instance = Get-SCOMClassInstance -Name "Server01.Contoso.com"

then you'll get a list of objects of different types, which are named after their parent server. So, if you are tying to put a windows server in Maintenenc Mode you need to filter out everything but an instance of a Windows Computer class:

$Instance = Get-SCOMClassInstance -Name "Server01.Contoso.com" | Where-Object { $_.GetClasses() -contains (Get-SCClass -Name Microsoft.Windows.Computer) }
于 2018-01-17T22:44:56.240 回答