Need to place the SCOM agents in Maintenance Mode automatically during Patching activity

Hi,
I have a requirement to place the SCOM agent servers in MM automatically during shceduled patching every month. I have gone through few blogs but could not find an apt solution for SCOM 2012 R2 environment.
I think the process should be..
 1. Create a management pack to monitor all servers for event 1074 (or/and 22), which gets triggere during the patching
 2. Write some powershell to put a machine into maintenance mode.
 3. Trigger the powershell script to run when needed.
Any suggestions please?
Thanks

Where doing this in our environment. We have a SCOM monitor looking for Reboot events (ID 1074) where the event contains Shutdown Type: Reboot. the monitor creates an Informational alert which Orchestrator picks up and then sets the machine in MM for 30
minutes. So its any time the machine is intentionally rebooted. You can have it look for CcmExec in the Event description (assuming you're using SCCM) if you only want it to work when being patched. 
- Slow is smooth and smooth is fast.

Similar Messages

  • 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

  • If an internal ID is changed for the Work Repository how does it affect objects that are already in it?  Will they continue to run or do you need to cycle the ODI agent?

    I was having trouble migrating the Master and Work repositories from my QA to my Prod environment.  I was getting an error message that the internal id's were alike so I changed the internal id in my Prod Master repository.  Then I tried to migrate the Work repository and was getting a similar error.  I did a search on the internet for the error message and it recommended that I renumber the Work repository so I did.    My concern now is how these changes affect the objects that are already in the repositories?  Will those objects continue to run?  Also do these changes take affect immediately or do you need to cycle the ODI agent?

    Well I cannot completely assure you but so far I have not faced any issues after a renumber. It will affect the exist object only when you have imported the object in synonym_update mode. I believe you have the daily backup of your production repository.
    Bhabani
    http://dwteam.in

  • Not able to find out the path where i need to place the .plx file on server

    I have to make some changes in the PLL (library) file and compile it into it's .plx file and move the .plx to the server.
    I am not able to find out the path where i need to place the .plx file on the server.
    I have placed it in /iasapp01/app_name/library,but it is not taking it into effect.
    Please help,if anyone knows about this,as to how to solve this issue
    Thanks
    GAG

    Hi Andreas,
    My Forms Version is 9.0.2 and the application server is 9iAS( 9.0.2)
    The variable FORMS90_PATH in the .env file has the following entries
    FORMS90_PATH=/iasapp01/app_name/fmx:/iasapp01/app_name/library:/iaspp01/app_name/html
    and i have placed the plx in the /iasapp01/app_name/fmx path,but somehow its not referencing it.
    My Formsweb.cfg has the following entry...
    [app_name]
    pagetitle=app_name_WEB
    serverapp=/app_name/app_name
    width=800
    height=550
    colorscheme=blue
    separateframe=true
    form=log.fmx
    otherparams=REPORT_PATH=/iasapp01/app_name/html/report_files/ FILE_PATH=/iasapp01/app_name/rep/
    WEB_PATH=http://server.com:7778/app_name/
    envfile=/ias01/app/oracle/product/ias_9.0.2/forms90/server/app_name.env
    I have another question which is ..Does applciation built on Forms 9.0.2 would work on Internet Explorer 8 and Windows 8 environment using Sun JRE.
    I was going through this website
    http://nutthaphon.blogspot.com/2009/05/how-do-jinitiator-and-jpi-parameters.html
    and followed the steps as mentioned,but it did not work for me.
    Can you help me if you have any info on this?
    Thanks
    GAG

  • Do I need to unload the GroupWise agents if I am installing WebAccess on its own server?

    Hi,
    I ma installing GW Web Access into our GW703 tree and the install is prompting me to unload all agents on the machine to which I am installing.
    As I am installing onto a separate server, I am assuming I can leave my PO, GWIA and MTA running?
    Can someone confirm this before I proceed?
    Thanks for your help

    Thanks!
    >>>
    From: Joseph Marton<[email protected]>
    To:novell.support.groupwise.7x.web-access
    Date: 07/23/2010 9:39 AM
    Subject: Re: Do I need to unload the GroupWise agents if I am installing Web Access on its own server?
    Jason wrote:
    > I ma installing GW Web Access into our GW703 tree and the install is
    > prompting me to unload all agents on the machine to which I am
    > installing.
    >
    > As I am installing onto a separate server, I am assuming I can leave
    > my PO, GWIA and MTA running?
    Yes, the install means to unload all agents running on the server where
    you are installing WebAccess. If all your agents are on other servers
    you can leave them running.
    Novell Knowledge Partner
    Enhancement Requests: http://www.novell.com/rms

  • HT1338 i've been getting an error when trying to play online games saying that i need to have the browser in 32 - bit mode. my browser is in 32 - bit mode but the msg keeps coming up and not running the game

    i've been getting an error when trying to play online games saying that i need to have the browser in 32 - bit mode. my browser is in 32 - bit mode but the msg keeps coming up and not running the game

    I dunno, that doesn't make any sense to me.
    I just shut down and rebooted into the SnowLeopard partition and took a peek at the preference panes.  There are only 3 that run in 32 bit only.  They are all 3rd party, and none of the prefpanes are non Intel.  Like I said, I have never owned a PPC machine.  Anyhow, SnowLeopard doesn't even have an iCloud prefpane, or a combined mail, contacts, and calenders prefpane, and the ML security and privacy prefpane is all new as well.  The software update prefpane is Intel and 64 bit in both SnowLeopard and Lion.
    As to the triple boot, unless I'm totally mistaken, what I have here is, in essence, 3 seperate descrete computers in one box.  All using the same hardware. but one at a time.  I wouldn't know how to get more than one running at the same time, without using a virtual machine, even if I wanted to.  (Which I don't)  I do sometimes transfer files from one to another using the shared folder, but other than that, they do not interact.  How could ML system preferences be trying to launch prefpanes from a totally different machine?

  • Host getting exit from Maintenance mode automatically

    Hi all,
    I have placed a ESXi 5.1 update 2 host into maintenance mode for host upgrade.
    After sometime, the host got exit from maintenance mode automatically ( Exit maintenance mode initiated by System).
    Have anyone faced this issue??
    Any solution/fix for this ...
    Please let me know.

    In order to uninstall a possibly unwanted extension, please do the following:
    #From the Firefox window click the Firefox button at the top left and select ''Add-ons'', or, if the Firefox button is not shown, click the ''Tools'' menu and click ''Add-ons''.
    #Once the Add-on Manager has opened in a new tab, click the ''Extensions'' button on the left side of the window.
    #You should now see a list of your installed extensions on the right side together with buttons on the right side of each extension.
    #To remove an extension from Firefox, simply click the ''Remove'' button. You should see a message that informs you about the successful removal of the add-on.
    #Note that some add-ons require a Firefox restart to be removed completely. To perform a Firefox restart after the add-on removal, click the ''Restart now'' link in the message.
    You can find further information about uninstalling extensions in the following articles:
    [[Disable or remove Add-ons]]
    [[Remove a toolbar that has taken over your Firefox search or home page]]

  • Need to place the data from database to right position in jsp page

    hello all java prople.. i m disigning a jsp page menu..which is having deep 4 level menu.. means one heading & 4 sub menu of each menus.. which is containing data from sql database...
    i can manage connection in between jsp page & d database.. but to place the data in right position is very typical....
    i need dyanamic insertion or deletion of menu item from the database..... help me out

    This has completely nothing to do with JDBC.
    I'll give you only a hint then: "hierarchial data". Google it in combination with some smart keywords, such as "SQL" or "database".

  • Need to place the window only in last page in script

    Hi,
      I want to place the footer window only in the last page.If it has 2 pages the footer window shhould come in second page only if there is only 1 page then it should come in the first page.
    can anyone tell me how to do this in Script.

    HI Camila,
    In such a case, donot use the footer of the Table , but create another window-FOOTER which is positioned after your table, with such a design, your footer would alwyas come only at the end of the Table.
    This is a simpler approach.
    The other approach could be to set Conditions in the condition tab of the footer , such as it comes only on the last page.
    If you take my suggestion, i would say use the 1st option i have explained.
    This will help you.

  • My printer has stop printing from the photo tray. I need to place the photo stock in the main tray

    I've a HP PhotoSmart Plus printer B210a.  The printer will no longer print from the photo tray.  I'm still able to get prints; but I must place the photo stock in the main tray.  It becomes a problem, because I sometimes forget the photo stock is the main tray and I waste photo stock when I do my regular printing and only get part it because the photo was still in the tray.  Anyway to fix this?

    Hi there wmcook,
    Could you provide the community with a little more information to help narrow troubleshooting? What operating system are you using and are there any errors when attempting to print from the photo tray?
    You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too.

  • NEED TO PLACE THE RECORDS POSITION BASED IN THE UNIX APPLICATION SERVER

    HI GURUS,
                            My internal table has 5 fields I have to palce these 5 fields in the application server(/var/opt...) at position based. Each field has to place in different position in the same row in the application server..
    please help me ....
    reward asure,
    with regards,
    Thambe.

    Hi Thambe,
    Can u be more clear on ur requirement. Find below solution as per my understanding.
    DATA: l_data TYPE string.
    OPEN DATASET po_file FOR OUTPUT IN TEXT MODE.
    CHECK sy-subrc IS INITIAL.
    LOOP AT itab INTO wa.
    CLEAR l_data.
    l_data = wa-f1.
    l_data+10(5) = wa-f2.
    l_data+20(10) = wa-f3.
    l_data+50(8) = wa-f4.
    l_data+100(20) = wa-f5.
    TRANSFER l_data TO po_file.
    ENDLOOP.
    CLOSE DATASET po_file.
    In the Above code at the time of transfer l_data contains all the 5 fields at the specified positions. U can specify the offsets and positions as per ur requirement.
    Thanks,
    Vinod.

  • I need to place the Maltese cross on a web page. IE works, Safari works, but Firefox does not. It is wingding character.

    The Maltese cross is in the winding font family. I have the following HTML on the pages:
    <pre><nowiki>
    <span class="cross" style="font-family: wingdings; vertical-align: top;">X</span></nowiki></pre>
    The inline element <span> tag is in a <font> tag.
    CSS: span.cross { color: #000; font-size: 16pt; font-weight: bold; }
    This has been working for years in IE 5, 6, 7 & 8, works also in safari (latest rev), but does not work in FireFox rev 4.0.1. FoxFire displays a large X instead of the Maltese cross.
    Other than this small problem FoxFire works great, especially with HTML5 & CSS3.
    Any help would be appreciated.
    DonL

    This concerns the Maltese cross problem. When I posted the problem, the data inside "<" and ">" characters is lost. The only thing that showed was the "X".
    I posted the HTML used to display the cross w/o these chars.
    span class="cross" style="font-family: wingdings; vertical-align: top" X /span
    Thanks for any help.
    DonL

  • When does the AT&T process the credit check? Upon ordering or during iTunes activation?

    New At&amp;t customer.  My credit card has already been charged for the pre order.

    I would guess before they would allow you to purchase a phone.
    Call them and ask.

  • "Class instance is already in Maintenance Mode" - but it isn't

    Hello,
    we have a powershell script to set the servers managed by scom agent in maintenance mode (e.g. for windows updates and restart).
    A colleague recognized an error during running this script. It says that instances of the server are still in maintenance mode. But if you check through SCOM it is not. And for resetting maintenance mode with 0 it says it is not in maintenance mode.
    Is it possible to clear maintenance mode for all things wiht a sql statement?
    Script:
    #=============================================================================#
    # Remote-MaintenanceModeV5.ps1 #
    # Powershell Script to put a SCOM agent into maintenance mode. #
    # Autor: Roman Strecker #
    # Date: 14.12.2012 #
    # Bekannte Fehler: Speicher auf dem Zielhost (SCOM) muss hoehergesetzt werden!#
    # winrm set winrm/config/winrs `@`{MaxMemoryPerShellMB=`"512`"`} #
    #=============================================================================#
    param(
    [Parameter(Mandatory = $false)][string]$ComputerName,
    [Parameter(Mandatory = $false)][string]$Dauer
    Function SetMaintenanceMode
    $ok = Test-Connection 10.202.14.29 -Count 1 -Quiet
    if (-not($ok)) {
    $SCOMServer = "srv14v030"
    else{
    $SCOMServer = "srv14v029"
    #Kleinster Zeitinterval bei SCOM sind 6 Minuten!
    if ([int]$Dauer -eq '0') {
    Write-Host "Löschen des Maintenance Modes wird durchgeführt!"
    $DeleteMM = $true
    else {
    if ([int]$Dauer -lt '6') {
    $Dauer = "6"
    $startTime = [DateTime]::Now
    $endTime = $startTime.AddMinutes($Dauer)
    Write-Host "`nFolgende Parameter werden verwendet: `nServername: $ComputerName `nWartungs-Dauer: $Dauer Minuten `nWartungsmodus wird geprüft..."
    #Get-ChildItem env:
    #Erzeuge ein Credential-Objekt für die Verbindung zum SCOM:
    $secpasswd = ConvertTo-SecureString "xxxxxx" -AsPlainText -Force
    $Credential = New-Object System.Management.Automation.PSCredential ("SA_SCOM-ActionAcc", $secpasswd)
    #Erzeuge eine Remote-Session zum SCOM:
    #$Session = New-PSSession -ComputerName $SCOMServer -Authentication kerberos
    $Session = New-PSSession -ComputerName $SCOMServer -Credential $Credential
    $Session = get-pssession
    Invoke-Command -Session $Session -ScriptBlock {
    param($ComputerName, $endTime, $DeleteMM)
    Import-Module OperationsManager
    try {
    $MonitoringObjects = Get-SCOMMonitoringObject | where {$_.DisplayName -like "$ComputerName*"}
    $MObject.ViewName
    catch {
    Write-Host "Fehler beim Verbinden mit dem SCOM ist aufgetreten!`nBitte versuchen Sie es später noch ein Mal."
    Write-Host "Vollständige Fehlermeldung: "$_.Exception.Message
    if ($MonitoringObjects -eq $null) {
    Write-Host "Servername konnte nicht gefunden werden: " $ComputerName
    else {
    foreach ($ComputerInstance in $MonitoringObjects) {
    if ($ComputerInstance.InMaintenanceMode) {
    if ($DeleteMM) {
    #Wartung muss gelöscht werden
    $ComputerInstance.StopMaintenanceMode([DateTime]::Now.ToUniversalTime(), "Recursive")
    $Ausgabe = "Server aus dem Wartungsmodus entfernt."
    else {
    #Server ist Bereits im Wartungsmodus
    $MMEntry = Get-SCOMMaintenanceMode -Instance $ComputerInstance
    Set-SCOMMaintenanceMode -MaintenanceModeEntry $MMEntry -EndTime $EndTime -Comment "Wartungsmodus wird angepasst."
    $Ausgabe = "Wartungsmodus für den Server " + $ComputerName + " ist angepasst bis " + ((Get-SCOMMaintenanceMode -Instance $ComputerInstance).ScheduledEndTime).ToLocalTime()
    else {
    if ($DeleteMM) {
    #Server war nicht im Wartungsmodus und soll gelöscht werden
    $Ausgabe = "Server war nicht im Wartungsmodus!"
    else {
    #Setzen des Servers in die Wartung
    Start-SCOMMaintenanceMode -Instance $ComputerInstance -EndTime $endTime -Reason "PlannedOther" -Comment "Wartungsmodus wird gesetzt."
    $Ausgabe = "Wartungsmodus für den Server " + $ComputerName + " ist gesetzt bis " + ((Get-SCOMMaintenanceMode -Instance $ComputerInstance).ScheduledEndTime).ToLocalTime()
    #Ausgabe für die letzte Instanz:
    Write-Host $Ausgabe
    } -ArgumentList $ComputerName, $endTime, $DeleteMM
    #Schliesse die Remote-Session
    Remove-PSSession -Session $Session
    #MAIN:
    #Prüfung, ob die Parameter eingeben wurden:
    if ($ComputerName -eq '') {
    $ComputerName = Read-Host "Bitte den Servernamen eingeben"
    $Dauer = Read-Host "Bitte die Dauer in Minuten eingeben (0 = Löschen des Wartungsfensters)"
    #Wenn noch immer nichts gesetzt ist, dann abgebrochen:
    if ($ComputerName -eq '' -OR $Dauer -eq '') {
    Write-Host "Vorgang abgebrochen!"
    else {
    SetMaintenanceMode
    Sleep 5
    Regards.

    Hi also in this post :)
    Thats a nice query - thank you. But the systems with the error are not listed.
    Maybe there is an error in our script:
    foreach ($ComputerInstance in $MonitoringObjects) {
    if ($ComputerInstance.InMaintenanceMode) {....$MMEntry = Get-SCOMMaintenanceMode -Instance $ComputerInstance

  • How to put a remote portlets server in maintenance mode

    Hi,
    We are running Plumtree Portal 5.0.4 on Windows 2000 Server SP4. We have a remote portlets server which hosts a lot of portlets' webservices.
    We need to put the remote server in maintenance mode.
    How can we disable all webservices hosted by this remote server without disabling each webservices manually (which will be painful) ?
    Regards,
    Qué Son PHAM VAN

    I don't want to encourage you to modify your database directly, but it seems to be the only way to do this easily. Try:
    update ptwebservices
    set enabled = 0, disabledmsg = 'This portlet has been disabled. Blah blah blah.'
    where gadgetserverid = 200;
    Replace 200 with the ID of your remote server.
    HTH,
    Chris Bucchere | bdg | [email protected] | http://www.bdg-online.com

Maybe you are looking for