Powershell Script to put Multiple Computers in Maintenance mode in SCOM 2007 R2
You can use the below script to add Mutiple Computer in Maintenance mode in SCOM 2007 R2
$comparr= get-content -file "c:\scomscripts\servert.txt"
$starttime = "12/25/2014 22:00" # Change the Starttime
$EndTime = "12/27/2014 23:00" # Change the Endtime
foreach($Computer in #comparr)
{
$objComputer =Get-agent | where-object {$_.Name -match $computer
$objComputer.HostComputer | New-MaintenaceWindow -StartTime:$starttime -EndTime:$EndTime -Comment" "Server in MM mode"
}
No comments:
Post a Comment