How to place multiple servers in Maintenance Mode in SCOM 2012

Hi All,
I am trying to place multiple servers in Maintenance Mode in SCOM 2012 but i could not find any PoSh script or any other solution to do it.
Could someone help me please?
Regards, Srini

Hi,
Please find the script.
need to have access and you can provide list of servers in text file.
 param([int32]$TimeMin, [string]$Reason, [string]$Comment)
                $api = new-object -comObject 'MOM.ScriptAPI'
                Import-Module operationsmanager
                New-SCOMManagementGroupConnection
                $Servers = Get-Content "ServerList.txt"
                $Time = (Get-Date).Addminutes($TimeMin)
                Foreach ($Server in $Servers)
                                #Get Computer instance
                                $ComputerClass = Get-SCOMClass -Name Microsoft.Windows.Computer
                                $ComputerClassInstance = Get-SCOMClassInstance  -Class $ComputerClass | Where {$_.DisplayName -eq $Server}
                                If ($ComputerClassInstance.InMaintenanceMode -eq $true)
                                #Write-Host $Server " is in maintenance mode"
                                Write-Host $Server" already under Maintenance Mode or not accessible by SCOM, skipped from script execution" -foregroundcolor "red"
                                $api.LogScriptEvent('MaintenanceModeScript.ps1', 201, 1, "$Server already found under MM, skipped from script execution")
                                Else
                                #Write-Host $Server " is NOT in maintenance mode, attempting to put in MM......."
                                If ($ComputerClassInstance -ne $Null)
                                                $HealthServiceWatcherClass = Get-SCOMClass -name:Microsoft.SystemCenter.HealthServiceWatcher
                                                #Get Health Service Watcher Class instance of the server
                                                $HSWClass = Get-SCOMClass -Name Microsoft.SystemCenter.HealthServiceWatcher
                                                $HSWClassIns = Get-SCOMClassInstance  -Class $HSWClass | Where {$_.DisplayName -eq $Server}
                                                #Starting the maintenance mode
                                                Start-SCOMMaintenanceMode -Instance $HSWClassIns -EndTime $Time -Reason $Reason -Comment
$Comment
                                                Start-SCOMMaintenanceMode -Instance $ComputerClassInstance -EndTime $Time  -Reason $Reason
-Comment $Comment
                                                Write-Host "Health Service Watcher and Agent server "$Server " kept in maintenance
mode for $TimeMin minutes"  -foregroundcolor "green"
                                                $api.LogScriptEvent('MaintenanceModeScript.ps1', 200, 0, "$Server kept in maintenance
mode for $TimeMin minutes")
                                Else
                                                Write-Host $Server" not found in Domain" -foregroundcolor "red"
                                                $api.LogScriptEvent('MaintenanceModeScript.ps1', 202, 1, "$Server not found in domain")
Regards
sridhar v

Similar Messages

  • Put servers in Maintenance Mode in SCOM 2012

    Hi,
    When we put a server in maintenance mode in SCOM 2012 it asks for only the end time. How can we specify the start time for maintenance mode.
    Thanks

    You can specify the start time for maintenance mode by schedule Maintenance mode.
    For how to create schedule for maintenance mode, you can refer below link
    http://support.microsoft.com/kb/2704170/en-us
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
    Mai Ali | My blog: Technical

  • How to schedule Maintenance Mode in SCOM 2012?

    Hi
    How do I schedule Maintenance Mode in SCOM 2012? Do we have any tool for 2012 like we had with 2007?
    Regards,
    Akhilesh
    Thanks, Akhilesh

    Yep - to add a calendar takes some extra steps:
    E.g. 
    1) Create a database which includes a table to store information such as:
    - target for maintenance mode
    - scheduled time for maintenance mode
    - Comments
    - Duration
    - Reason
    2) The Service Request fires off an Orchestrator runbook that stores this information in the database
    3) Another Runbook that runs frequently that checks the database to see if it should kick off maintenance mode.
    It isn't any easy solution for maintenance mode. It works better for more simplistic scheduling e.g. we do implement this kind of logic for environment refreshes and backups where we use the SM Portal and Orchestrator to log a date and then have another
    runbook that runs at 2am every day to check if it should execute a backup \ refresh.  
    Cheers
    Graham
    Regards Graham New System Center 2012 Blog! -
    http://www.systemcentersolutions.co.uk
    View OpsMgr tips and tricks at
    http://systemcentersolutions.wordpress.com/

  • Script for putting servers under Maintiance mode in SCOM 2012

    Hi,
    Could someone pls help me out for putting windows servers under maintiance mode by using poweshell script. We have nearly 300 windows servers and needs to be put in maintiance mode as there was a scheduled activity. We are using scom2012 server.  I
    have gone through other sites and see some poweshell scripts. As am not good in scripting, pls help me out
    Regards, Rajeev Parambil

    Hi,
    Hope the below links can be useful for you:
    SCOM maintenance mode setting for list of servers
    http://blogs.technet.com/b/markmanty/archive/2012/05/14/scom-maintenance-mode-setting-for-list-of-servers.aspx
    Put Agents in Maintenance Mode using Remoting Powershell
    http://social.technet.microsoft.com/Forums/systemcenter/en-US/2171ef8f-4a7f-4ec0-8d35-d5a903884dff/put-agents-in-maintenance-mode-using-remoting-powershell-?forum=operationsmanagergeneral
    Regards,
    Yan Li
    Regards, Yan Li

  • Looking for a Powershell Script which can put the scom servers in maintenance mode

    Looking for a Powershell Script which can put the scom servers in maintenance mode so that SCOM should not send an alert during planned task.
    Rahul

    1. Provide list of servers line-by-line in C:\ServerList.txt, make sure you provide limited no. of servers, do not exceed 20 - 25 per batch
    2. Save the script with suitable name (test.ps1)
    3. Open PowerShell cmd prompt
    4. Script accepts 3 params - TimeInMinutes, Reason and Comment
    **** Please note, this script will work for SCOM 2012 R2
    param([int32]$TimeMin, [string]$Reason, [string]$Comment)
    try
    $api = new-object -comObject 'MOM.ScriptAPI'
    Import-Module operationsmanager
    New-SCOMManagementGroupConnection
    $Servers = Get-Content "C:\ServerList.txt"
    $Time = (Get-Date).Addminutes($TimeMin)
    Foreach ($Server in $Servers)
    #Get Computer instance
    $ComputerClass = Get-SCOMClass -Name Microsoft.Windows.Computer
    $ComputerClassInstance = Get-SCOMClassInstance  -Class $ComputerClass | Where {$_.DisplayName -eq $Server}
    If ($ComputerClassInstance -ne $Null)
    $HealthServiceWatcherClass = Get-SCOMClass -name:Microsoft.SystemCenter.HealthServiceWatcher
    #Get Health Service Watcher Class instance of the server
    $HSWClass = Get-SCOMClass -Name Microsoft.SystemCenter.HealthServiceWatcher
    $HSWClassIns = Get-SCOMClassInstance  -Class $HSWClass | Where {$_.DisplayName -eq $Server}
    #Starting the maintenance mode
    Start-SCOMMaintenanceMode -Instance $HSWClassIns -EndTime $Time -Reason $Reason -Comment $Comment
    Start-SCOMMaintenanceMode -Instance $ComputerClassInstance -EndTime $Time  -Reason $Reason -Comment $Comment
    Write-Host "Health Service Watcher and Agent server "$Server " kept in maintenance mode"  -foregroundcolor "green"
    $api.LogScriptEvent('MaintenanceModeScript.ps1', 200, 0, "$Server kept in maintenance mode for $TimeMin minutes")
    Else
    Write-Host $Server" not found " -foregroundcolor "red"
    $api.LogScriptEvent('MaintenanceModeScript.ps1', 201, 1, "$Server could not be found in domain")
    Catch [system.exception]
    $api.LogScriptEvent('MaintenanceModeScript.ps1', 201, 1, $_.Exception.Message)
    Faizan

  • HT201263 how to place your device into recovery mode without home button?

    How to place your device into recovery mode without home button?

    Try these programs:
    RecBoot: Easy Way to Put iPhone into Recovery Mode
    The Firmware Umbrella - TinyUmbrella

  • How to place multiple images?

    Hi,
    How to place multiple images?
    Regards,
    Learner

    Is the script creating the frames? If so, just assign each frame a
    variable, or make them all into an array. Then use something like:
    myFrame.place("aFile");
    If the script is not creating the frame, then are they live frames on
    the page, or are they actually on a master page?
    If they're on master spreads, you'll have to release them to the page
    you want. (I think it's myMasterFrame.override(myPage) where myPage is
    the live page you want to detach them on, but you'll have to double
    check that.)
    But presuming they're regular detached frames on a page, if you want
    your script to figure out which is the first and which is the second you
    can either use script labels in the UI and then search for the script
    label, or else you'll have to write a function that will get all
    rectangles on the page (myPage.rectangles.everyItem().getElements() and
    either do a clever javascript sort, or write a straightforward function
    to sort them by height and x-pos.
    Hope that sheds some light on the task ahead!
    Ariel

  • How to place multiple images in batch with drop shadow effects on room backgrounds at the same position?

    I want to place multiple images of hand paintings with drop shadow effects on room backgrounds to make them look as if the paintings are hanged on the room walls. I know how to do it one by one, but that takes time and I want to do it in batch at once.
    I am quite a beginner for adobe photoshop CS6. I belive such an automated task is possible through 'Automated Batch' function and/or 'Create Droplet' function. Kindly share your expert opinion.

    If you want to go with Batch I would recommend creating an Action of more or less these steps:
    • set the resolution to the same as the background image’s
    • change the image from Background Layer to regular Layer if necessary
    • convert it to a Smart Object
    • add a Drop Shadow Layer Style to the image (do not use Global Angle)
    • place the background image (File > Place …)
    • move it behind the image layer
    • Image > Reveal All
    • make Selection from that layer’s transparency (cmd-click its icon in the Layers Panel) and use Image > Crop
    • select and transform the image layer to fit the intended position
    This would naturally work out best if the images had the same size and proportions.
    For the reflection on the floor duplicate the image, flip it vertically, move it in position and reduce its opacity to maybe 10%.
    Realistically you may have to hide it partially behind the pillows, a Vector Mask would be an option.

  • How to place multiple images of hand paintings with drop shadow effects on room backgrounds?

    I want to place multiple images of hand paintings with drop shadow effects on room backgrounds to make them look as if the paintings are hanged on the room walls. I know how to do it one by one, but that takes time and I want to do it in batch at once.
    I am quite a beginner for adobe photoshop CS6. I belive such an automated task is possible through 'Automated Batch' function and/or 'Create Droplet' function. Kindly share your expert opinion.

    If you want to go with Batch I would recommend creating an Action of more or less these steps:
    • set the resolution to the same as the background image’s
    • change the image from Background Layer to regular Layer if necessary
    • convert it to a Smart Object
    • add a Drop Shadow Layer Style to the image (do not use Global Angle)
    • place the background image (File > Place …)
    • move it behind the image layer
    • Image > Reveal All
    • make Selection from that layer’s transparency (cmd-click its icon in the Layers Panel) and use Image > Crop
    • select and transform the image layer to fit the intended position
    This would naturally work out best if the images had the same size and proportions.
    For the reflection on the floor duplicate the image, flip it vertically, move it in position and reduce its opacity to maybe 10%.
    Realistically you may have to hide it partially behind the pillows, a Vector Mask would be an option.

  • How to place multiple commands using lcdui package?

    I want to place multiple commands using lcdui package. I find that if I use more than 3 it becomes a menu item. How to circumvent this?
    With regards,
    Amin

    i dont think you would be able to do this because of the screen size and also because all the cell phones only provide back,exit & menu buttons to program.so thats why you need to place the commands in the screen if the number of options are more.

  • How to start Multiple servers?

    Hi,
    plz explain How to start jboss Multiple servers at a time?where is the configure?

    I guess creating multiple server instances in jboss 5 and above versions have different approaches. Below are steps to create multiple server instances in jboss 5:
    [1]. Go to <jboss_home>/servers
    [2]. Copy and past detault instance with appropriate name, like "MyApp"
    [3]. Open <Jboss_home>/servers/MyApp//conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
    [4]. Find line <parameter>${jboss.service.binding.set:ports-default}</parameter> and change "ports-default" ports-01/ports-02/ports-03 to assign ports 8108/8289/8380 respectively.
    Alternate solution is to use:
    ./run.sh -c node1 -b 0.0.0.0 -Djboss.service.binding.set=ports-01 -Djboss.messaging.ServerPeerID=1
    Hope this helps.
    -RMishra

  • How to put Mediation Server on Maintenance Mode for LYNC server 2013

    how to put the LYNC 2013 Mediation server on Maintenance mode???

    Hi,
    Did you solve the issue with the help the people above provided?
    If you mean server draining feature you can also check Topology option on Lync Server Control Panel, on Topology interface, click “Action” and there is an action called “Prevent new sessions for service”.
    Here is a similar case may help you:
    http://social.technet.microsoft.com/Forums/lync/en-US/ef3515a9-54c0-4b7a-ab48-45196764d837/how-to-use-lync-server-draining-feature?forum=ocsplanningdeployment
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • How to place a WAP into Maintenance State in Cisco WCS

    I presently have a WAP offline and WCS continually alerts that the WAP Radio interfaces are down.
    I am logged into WCS with Admin priveleges, but if I select the WAP and opt to place the WAP into Maintenance State so as to suppress the alarms, WCS reports back "Permission Denied - You do not have privileges for the requested operation."
    The WAP is operating LWAPP
    What is causing the denial ? Any suggestions please.
    Thanks
    David

    Hi,
    The problem has been identified and is a bug in the latest version of WCS being 7.0.172.0
    According the Cisco, the Bug is to be fix in the next version of WCS due for release later this year pending code updates for the controllers making them compatible with the new version of WCS. Details of the Bug can be found here :
    http://tools.cisco.com/Support/BugToolKit/search/getBugDetails.do?method=fetchBugDetails&bugId=CSCtq83879
    Anyway, to place the WAP in Maintenance State, you will need to change your WCS AAA settings via Administration>>AAA Mode and set to Local. Proceed then via a second IE session to log into WCS using the Root username and Password and place the WAP in Maintenance State. Following placing the WAP in Maintenance State, change your AAA Mode back to TACACS+ or RADIUS with fallback to local.
    Regards

  • How to place multiple list box in Module Pool Program having same option.

    I have a screen. I want to place multiple i/o box with listbox option having 10 option of each . Is it possible ?

    Hi Manoj,
    Sorry, did not got you. You mean list box with 10 options, just this?
    Or Cascading list box?
    regards,
    Archer

  • SQL Query for maintenance mode in SCOM

    Hi all
    I was wondering if I can find a query about this request:
    - Found all the Servers that were restart without the maintenance mode were actived ?
    It's to make a Report To include in Reporting Services.
    sorry for my English :)
    Thank you very much and have a good day

    Your question seems related to SCOM. SCOM may use SQL Server, but to answer the question, I guess one needs to know SCOM, so maybe you should try a forum for that product? I found
    http://social.technet.microsoft.com/Forums/systemcenter/en-US/home?forum=operationsmanagergeneral
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for

  • Voice dial does not confirm nor allow cancel

    When I use voice dial (usually via bluetooth headset on iPhone 3GS), if the iPhone decides it has found an exact match, it will notify me of the match and then start dialing.  It does not confirm the match with me, and when it starts dialing, the "Ca

  • ITunes 6.0.1.3 install seems to finish, but then dies

    Alrighty. So I'm a tech by trade in Austin, Texas. I've seen plenty of iTunes installs, and itunes install problems, but this is the first to stump me. My little brother's computer was running itunes 4.7 just fine. However, since version 5 i have bee

  • What do i do for this error?

    Mapping validation Error: "For mapping code generation, the generated language needs to be the same for every operator in the mapping. Check the mapping and remove conflicting components." What are the conflicting components? The mapping I had was ha

  • PDF Maker not shown in excel 2013 ribbon

    I have got Windows 7 64-bit. I have excel 2013 installed on it. I have recently installed every version of adobe acrobat reader but when i open excel I cant see the PDF Maker add-in in the ribbon. I have checked it in COM-Add ins list and it is being

  • Supplier Registration and Preselection

    Hi all, We are trying to configure Supplier Registration and preselection process in SRM: When Supplier is filling Registration form then we try to send it but It got an error message: "Administration SRM isn’t available" What has happened? Regards,