这是我正在使用的代码:
$Time = ((Get-Date).AddMinutes(240))
Start-SCOMMaintenanceMode -Instance TEST -EndTime $Time -Comment "Applying
Software Updates."
这是我正在使用的代码:
$Time = ((Get-Date).AddMinutes(240))
Start-SCOMMaintenanceMode -Instance TEST -EndTime $Time -Comment "Applying
Software Updates."
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) }