Optimized Group Maintenance Mode PowerShell for OpsMgr: 2012 R2 Edition

Below is the latest sample of optimized group maintenance mode for System Center Operations Manager (SCOM), which leverages the .ScheduleMaintenanceMode function, which allows for the inclusion of a request for recursion….the implementation of the “this object and contained objects”. This minimizes SDK calls and processing overhead for large groups.

Syntax:
GroupMaintMode -ScomServer “mmsscom01” -GroupDisplayName “SQL Server 2008 Computers” -DurationInMin 10 -Reason “ApplicationInstallation” -Comment “Scheduled weekly maintenance”

#--------Begin Sample Script----------------
#*****************************************************************************
#
# Name: OpsMgr 2012 Group Maintenance Mode 
#
# Description: Puts Groups into Maintenance Mode 
#
# Authors: Pete Zerger and Matthew Long  
#
# Parameters:
#
# -ScomServer: mandatory parameter containing mgmt server name (Netbios or FQDN)
# -GroupDisplayName: mandatory parameter containing display name of the target group
# -DurationInMin: mandatory parameter containing integer of desired duration in minutes
# -Reason: mandatory parameter containing reason. Acceptable values are UnplannedOther, 
#           PlannedHardwareMaintenance, UnplannedHardwareMaintenance,

#           PlannedHardwareInstallation, 
#           UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, 
#           UnplannedOperatingSystemReconfiguration, PlannedApplicationMaintenance, 
#           ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable, 
#           SecurityIssue, LossOfNetworkConnectivity
# -Comment: optional parameter with free text description of your choice
#
#
#*****************************************************************************

Function GroupMaintMode 
#($ScomServer, $GroupDisplayName, $DurationInMin, $Reason, $Comment)
(
[Parameter(Mandatory=$true)][string]$ScomServer,
[Parameter(Mandatory=$true)][string]$GroupDisplayName,
[Parameter(Mandatory=$true)][Int32]$DurationInMin,
[Parameter(Mandatory=$true)][string]$Reason,
[Parameter(Mandatory=$false)][string]$Comment
){

Import-Module OperationsManager
New-SCOMManagementGroupConnection -ComputerName $ScomServer

ForEach ($Group in (Get-ScomGroup -DisplayName  $GroupDisplayName))
    {
   If ($group.InMaintenanceMode -eq $false)
         {
            $group.ScheduleMaintenanceMode([datetime]::Now.touniversaltime(), `
            ([datetime]::Now).addminutes($DurationInMin).touniversaltime(), `

             "$Reason", "$Comment" , "Recursive")
         }
    }

}

#Usage (calling the GroupMaintMode function)
GroupMaintMode -ScomServer "mmsscom01" -GroupDisplayName "SQL Server 2008 Computers" `
-DurationInMin 10  -Reason "ApplicationInstallation" -Comment "Scheduled weekly maintenance"

#--------End Sample Script----------------

#Usage (calling the GroupMaintMode function)
GroupMaintMode -ScomServer "mmsscom01" -GroupDisplayName "SQL Server 2008 Computers" `
-DurationInMin 10  -Reason "ApplicationInstallation" -Comment "Scheduled weekly maintenance"

#--------End Sample Script----------------

Questions or comments? Use the comments section below.

OpsMgr Overrides Report: 2012 R2 Edition

The following is latest tweak of my custom Overrides Report for System Center Operations Manager 2012 R2:

# ==============================================================================================
#
# NAME: OpsMgr Overrides Report
#
# ORGINAL AUTHOR: Daniele Muscetta and Pete Zerger
# ORGINAL DATE : 8/24/2010
#
# EDITED BY: Arjan Vroege
# EDITED DATA : 1/24/2014
#
# COMMENT: This report will output the overrides in your OpsMgr environment including
# override settings, target, source rule/monitor and source management pack.
# ==============================================================================================
#---Save the following text as script "Export-Overrides.ps1"

#Parameters
Param(
[Parameter(Mandatory=$true)] [string]$MS,
[Parameter(Mandatory=$true)] [string]$MP_Name,
[Parameter(Mandatory=$true)] [string]$output
)

#Connect to SCOM Environment
Import-Module OperationsManager
New-SCOMManagementGroupConnection -ComputerName $MS

#define the path you want to export the CSV files to
$exportpath = ""
$MPRpt = $null
$MPRows = $null

#gets all UNSEALED MAnagement PAcks
$mps = Get-SCOMManagementpack | where {$_.DisplayName -eq $MP_Name}

#loops thru them
foreach ($mp in $mps) {
$mpname = $mp.name
Write-Host "Exporting Overrides info for Management Pack: $mpname"

#array to hold all overrides for this MP
$MPRows = @()

#Gets the actual override objects
$overrides = $mp.GetOverrides()

#loops thru those overrides in order to extract information from them
foreach ($override in $overrides) {
#Prepares an object to hold the result
$obj = new-object System.Management.Automation.PSObject

#clear up variables from previous cycles.
$overrideName = $null
$overrideProperty = $null
$overrideValue = $null
$overrideContext = $null
$overrideContextInstance = $null
$overrideRuleMonitor = $null

#give proper values to variables for this cycle. this is what we can then output.
$name = $mp.name
$overrideName = $override.Name
$overrideProperty = $override.Property
$overrideValue = $override.Value

trap { $overrideContext = ""; continue } $overrideContext = $override.Context.GetElement().DisplayName
trap { $overrideContextInstance = ""; continue } $overrideContextInstance = (Get-SCOMClassInstance -Id $override.ContextInstance).DisplayName

if ($override.Monitor -ne $null) {
$overrideRuleMonitor = $override.Monitor.GetElement().DisplayName
} elseif ($override.Discovery -ne $null) {
$overrideRuleMonitor = $override.Discovery.GetElement().DisplayName
} else {
$overrideRuleMonitor = $override.Rule.GetElement().DisplayName
}

#fills the current object with those properties

#$obj = $obj | add-member -membertype NoteProperty -name overrideName -value $overrideName -passthru
$obj = $obj | add-member -membertype NoteProperty -name overrideProperty -value $overrideProperty -passthru
$obj = $obj | add-member -membertype NoteProperty -name overrideValue -value $overrideValue -passthru
$obj = $obj | add-member -membertype NoteProperty -name overrideContext -value $overrideContext -passthru
$obj = $obj | add-member -membertype NoteProperty -name overrideContextInstance -value $overrideContextInstance -passthru
$obj = $obj | add-member -membertype NoteProperty -name overrideRuleMonitor -value $overrideRuleMonitor -passthru
$obj = $obj | add-member -membertype NoteProperty -name MPName -value $name -passthru
$obj = $obj | add-member -membertype NoteProperty -name overrideName -value $overrideName -passthru

#adds this current override to the array
$MPRows = $MPRows + $obj
}

#Store up the overrides for all packs to a single variable
$MPRpt = $MPRpt + $MPRows
}

if($output -eq "csv") {
#exports cumulative list of overrides to a single CSV
$filename = $exportpath + "overrides" + $mp.name +".csv"
$MPRpt | Export-CSV -path $filename -notypeinfo
} elseif ($output -eq "html") {
$filename = $exportpath + "overrides" + $mp.name +".htm"
$MPRpt | ConvertTo-Html | Out-File $filename
}

Questions or comments? Use the comments section below.

Free E-book: Inside the Microsoft Operations Management Suite

Tao (@MrTaoYang), Stan (@StanZhelyazkov), Anders (http://contoso.se)  and I have been working on a project for the last few weeks. We wanted to bring a learning resource for the MS Operations Management Suite to the community that is complete, comprehensive, concise…and free (as in beer). While we finish final editing passes over the next couple of weeks, we wanted to share an early copy of the book so you can start digging in while we finish our work!

Description: This preview release of “Inside the Microsoft Operations Management Suite” is an end-to-end deep dive into the full range of Microsoft OMS features and functionality, complete with downloadable sample scripts (on Github). The chapter list in this edition is shown below:

  • Chapter 1: Introduction and Onboarding
  • Chapter 2: Searching and Presenting OMS Data
  • Chapter 3: Alert Management
  • Chapter 4: Configuration Assessment and Change Tracking
  • Chapter 5: Working with Performance Data
  • Chapter 6: Process Automation and Desired State Configuration
  • Chapter 7: Backup and Disaster Recovery
  • Chapter 8: Security Configuration and Event Analysis
  • Chapter 9: Analyzing Network Data
  • Chapter 10: Accessing OMS Data Programmatically
  • Chapter 11: Custom MP Authoring
  • Chapter 12: Cross Platform Management and Automation

This early edition is being shared with the community while final edits are being completed. Please send questions, comments or errata you find to insidemscloud@outlook.com.

You can download for free from the TechNet Gallery at:
https://gallery.technet.microsoft.com/Inside-the-Operations-2928e342 

 

SCOM Health Check Reports v3 on GITHUB

Oskar and I recently collaborated to update the SCOM Health Check Reports we wrote so long ago for Operations Manager 2012 R2 (SCOM).

We have posted the managment pack and guide on the Microsoft TechNet Gallery at https://gallery.technet.microsoft.com/SCOM-Health-Check-Reports-c32e8f93.

We have posted the source code on GITHUB in a repository as well. The GIT repository is located at https://github.com/pzerger/scomhealthcheck.

I’ll post a separate article with tips on how to get the most from the SCOM Health Check Reports in the next few days!

Inside System Center 3: Best Free System Center Solutions – Show Notes

In this episode, Dan and Pete talk about some of the more robust free solutions for System Center 2012 R2, including a couple of gems you have not seen before! Links to all the resources discussed (and some we didn’t get to) below!

New Show Updates

To get updates on the latest episodes of Inside System Center and Inside the Microsoft Cloud, follow on twitter (@insidemscloud@insidepodcast) or like us on Facebook at http://facebook.com/insidepodcastnetwork.

Episode Links

Audio editionavailable shortly!

Video edition – https://www.youtube.com/watch?v=tKfoJ-hBv0Y

OpsMgr 2012 R2

While there are thousands of great articles and scripts and related solutions for OpsMgr, here are a few of the more function-rich freebies. A couple of lesson known solutions in here! 

NiCE Log File Monitoring MP

https://www.nice.de/log-file-monitoring-scom-nice-logfile-mp

https://www.nice.de/wp-content/uploads/2015/01/NiCE_LogFileMP_SolutionBrief_2015Q1.pdf

MP Author (Silect Software)

http://www.silect.com/mp-author
OpsMgr Self Maintenance Management Pack (by Tao Yang)

http://blog.tyang.org/2013/03/03/opsmgr-self-maintenance-management-pack/

PKI Certificate Verification MP (by Raphael Burri)

https://rburri.wordpress.com/2015/06/22/pki-certificate-verification-mp-update-1-3-0-0/

Effective Configuration Viewer (Stefan Roth)

https://gallery.technet.microsoft.com/Get-effective-configuration-753e13bd

Adding GUI Authoring Support for PowerShell Monitors in OpsMgr (Wei H Lim)

https://gallery.technet.microsoft.com/Sample-Management-Pack-17b76379

ConFigMgr 2012 R2

While most everyone is familiar with the right click tools, we discussed a couple of other (and in some cases newer)  free solutions.

RegkeyToMof

http://myitforum.com/cs2/files/folders/proddocs/entry152945.aspx

RemoteManage

http://cireson.com/apps/remote-manage/

PowerShell Inventory Script (David O’Brien)

http://www.david-obrien.net/2014/01/update-inventory-script-makes-configmgr-life-easier/

Kent Agerland’s List of Community Tools

http://blog.coretech.dk/kea/community-tools-from-system-center-universe-2014/

Service Manager 2012 R2

Here are a few of our favorites for SCSM.

SCSM Dashboards (by Signature Consultancy)

http://www.signatureconsultancy.com/scsm-dashboard.html

SCSM Entity Explorer

https://gallery.technet.microsoft.com/SCSM-Entity-Explorer-68b86bd2

Free Community Stream (from Cireson Software)

DPM

SCOM DPM Dashboard

http://www.buchatech.com/2014/04/new-scom-dpm-dashboard-download

https://gallery.technet.microsoft.com/SCOM-DPM-Dashboard-8eef9b58

SCO / SMA / AA

Automating Software License Reclamation with System Center 2012 SCCM + Orchestrator

Part 1 – Software Metering Deep Dive and Automation Part 1: Use It Or Lose It – The Basics

This installment has a quick overview of the software metering feature in case you’re not familiar.

Part 2 – Software Metering Deep Dive and Automation Part 2: Use It Or Lose It – The Collections

This installment includes the collections of those systems using an application, and another collection with systems where the application is not being used.

Part 3 – Software Metering Deep Dive and Automation Part 3: Use It Or Lose It – The Orchestrator Runbook Automation

Sample Runbooks – Automation Use Cases

https://gallery.technet.microsoft.com/Sample-Runbooks-Automation-fafd8f13

http://blogs.technet.com/b/privatecloud/archive/2013/08/12/automation-orchestrator-back-to-basics-use-cases-spotlight-1-of-5.aspx

Orchestrator Sample Runbooks: Core Examples, PowerShell Examples, and Scenario E

https://gallery.technet.microsoft.com/Orchestrator-Sample-1bbb04a5

 

Inside System Center #2: OpsMgr Dashboarding – Show Notes

In this episode, we had a panel to discuss the host of dashboarding options for System Center 2012 R2 Operations Manager. This is a video podcast, so be sure to check out the demos of each vendor presented in this episode! 

Watch the episode at https://youtu.be/NuMAUKEDkx0

Savision

Resources related to Savision courtesy of Cameron Fuller (@CFullerMVP)

Savision whitepaper: “Is OpsMgr Still relevant in the Cloud?:: https://www.savision.com/free-whitepaper-mvp-cameron-fuller-tackling-elephant-room-opsmgr-still-relevant-cloud
Blog post series on OpsMgr and mobile: “Taking my OpsMgr with me”: http://blogs.catapultsystems.com/cfuller/archive/2014/04/11/taking-my-opsmgr-with-me-wrap-up/
Blog post on the new Dashboards product: “Kicking the tires”: http://blogs.catapultsystems.com/cfuller/archive/2015/04/09/kicking-the-tires-on-the-new-dashboards-by-savision-product-1/
Savision whitepaper: “The Road to the Cloud”: https://www.savision.com/resources/white-paper/road-cloud-mvp-cameron-fuller-0 (not specifically mentioned but relevant to the conversation)

Squared Up

Resource links for Squared Up, courtesy of Tao Yang (@MrTaoYang)
Squared Up Perf Data:
http://blog.tyang.org/2015/03/12/accessing-opsmgr-performance-data-in-squared-up-dashboard/

Visio Dashboard for existing DA:
http://blog.tyang.org/2015/05/28/how-to-create-a-squared-up-visio-dashboard-for-an-existing-distributed-application/

Collecting Data to OMS example (I think I mentioned it in the beginning):
http://blog.tyang.org/2015/06/10/collecting-configmgr-logs-to-microsoft-operation-management-suite-the-nice-way/

Also, the Visio maps I used in the demo today can be downloaded for free from here:
http://www.amcharts.com/svg-maps/

Opslogix (ProView)

Resource links for Opslogix ProView, courtesy of Pete Zerger (@pzerger)

ProView homepage – http://www.opslogix.com/proview/

Getting Started Videos

Keep an eye out for new episodes of the Inside System Center podcast twice a month on the Inside Podcast Networks website at http://ipn.tv.