Wednesday, February 15, 2017

Quickfix: OpsMgr console crash with System.IO.FileNotFoundException error

Ran into an issue at a customer site today and I want to remember how to resolve it next time Smile

Installed the OpsMgr 2012 console by running the OMConsole.msi file instead of launching the installation from the splash screen, and then launched the console. The console will attempt to load, and then fail with a .Net error. The following event will be logged in the Application Event Log:

image

EventID: 1026
Source: .NET Runtime

Event message:

Application: Microsoft.EnterpriseManagement.Monitoring.Console.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
   at Microsoft.EnterpriseManagement.Mom.Internal.UI.Console.ConsoleJobExceptionHandler.ExecuteJob(System.ComponentModel.IComponent, System.EventHandler`1<Microsoft.EnterpriseManagement.ConsoleFramework.ConsoleJobEventArgs>, System.Object, Microsoft.EnterpriseManagement.ConsoleFramework.ConsoleJobEventArgs)
   at Microsoft.EnterpriseManagement.ConsoleFramework.ConsoleJobsService.JobThread(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

Issue is caused by missing prerequisite files, particularly the ReportViewer prereq. Download and install SQL CLR types and ReportViewer, and relaunch the console, and hey Presto!

Wednesday, January 18, 2017

Quick agent health check script

A long long time ago in a life far far away, I wrote a quick and dirty agent health check script that allowed me to keep an eye on the unhealthy agents in my environments. I updated it over the years, but always kept it as VBScript, which is obviously now a little out of date, since everyone wants to use the far more posh PowerShell. So, here is a PS version.

Update the highlighted bits, save as a ps1 file and be sure to test in your lab before using in production. Script provided without guarantees.

##############################################################################
#
#   SCOM-Agent-healthCheckscript.ps1
#
#    This script retrieves all unhealthy agents from OpsMgr, and pings them.
#
##############################################################################

# Variables

$FromEmail = "<from email address>"
$ToEmail = "<recipient email address>"
$MailServer = "<mail server>"

$ReportDate = Get-Date -format "yyyy-M-dd"

# there should be no need to update the script beyond this point

# Open the content
#$body = @()

$body = "<table><tr><td><b>Server Name</b></td><td><b>Ping Response</b></td></tr>"

# Connect to Operations Manager

Import-module OperationsManager

# Fetch the agent information
$AgentClass = get-SCOMClass -name "Microsoft.SystemCenter.Agent"
$Agents = Get-SCOMMonitoringObject -class:$AgentClass | where {$_.IsAvailable -ne "Success"}

# Set the counters to Zero
$n = 0
$i = 0

# Loop through the unhealthy agents and ping them
foreach ($Agent in $Agents) {
$n = $n+1

   if (test-Connection -ComputerName $Agent -Count 2 -Quiet )
        {
    $Status = "Responds"
         }
         else
         {
      $Status = "Unreachable"
      $i = $i+1
         }

# Status update
Write-Host "$Agent checked"

# Write to the report
$ReportOutput = "<tr><td>$Agent</td><td>$Status</td></tr>"
$body += $ReportOutput
}

$body += "</table>"

# Write-Host "There are $n agents in total and $i not pinging"

$mbody = "<p>There are <b>$n</b> agents in total and <b>$i</b> not pinging</p> $body"


Write-Host “Sending Email”

#Creating a Mail object
     $msg = new-object Net.Mail.MailMessage
    
#Creating SMTP server object
     $smtp = new-object Net.Mail.SmtpClient($mailserver)

#Email structure
$Subject = "SCOM Agent Health Check - $ReportDate"

     $msg.From = $FromEmail
     $msg.ReplyTo = $FromEmail
     $msg.To.Add($ToEmail)
     $msg.subject = $Subject
     $msg.IsBodyHtml = $true
     $msg.body = $mbody

  #Sending email
    $smtp.Send($msg)

#write-host "Email sent"

Thursday, October 22, 2015

Quick fix: Report Subscription Owner change

When you create report subscriptions using the OpsMgr console, your user account’s guid (assigned by SSRS internally) is made the owner of the subscription. If your user account is removed or disabled, this will cause the report subscriptions to fail. To fix this, you need to replace the owner GUID with a GUID of a valid user. To do so, you can use the following steps:

  1. Using the SQL Server Management Studio, connect to the server hosting the ReportServer database for your OpsMgr environment
  2. Select the ReportServer database, right click and select New Query
  3. Run the following query:

    select OwnerID from subscriptions
    where laststatus like '%Failure%'

    This returns the OwnerID of any reports that have failed to run. You will need this OwnerID for step 5

  4. Open another New Query window, and run the following query:

    select OwnerID from subscriptions
    where laststatus not like '%Failure%'

    This returns the OwnerID of any reports that have not failed to run. You will need this OwnerID for step 5

  5. Open another New Query window, and run the following query:

    USE [ReportServer]
    GO

    UPDATE [dbo].[Subscriptions]
    SET [OwnerID] = <OwnerID of successful reports>
    WHERE OwnerID = <OwnerID of failed reports>
    GO

    It should look something like this:

    USE [ReportServer]
    GO

    UPDATE [dbo].[Subscriptions]
    SET [OwnerID] = '9DF9EBCD-F913-40C1-AEF9-0F7634EAE571'
    WHERE OwnerID = '94738FA7-FD24-4190-9B64-355557DF0035'
    GO

Thursday, October 9, 2014

First glance: System Center vNext Operations Manager Technical Preview

Along with the announcement of Windows 10 last week, the Technical Previews of the System Center suite and Windows Server was also announced. I finally got round to installing into my lab. Prerequisites match those of System Center 2012 R2 Operations Manager, with the required SQL version being SQL Server 2014.

The most obvious new feature I can see are a bunch of new widget types for the Dashboards:

image

I can see some very attractive new dashboards being built. I just played a little bit with some of the widgets, and considering I have nothing monitored yet, this is not too shabby :)

image

Now to get some agents in and push this puppy.

Sunday, October 5, 2014

First glance: Windows 10

The technical preview of Windows 10 was announced this week and is open to the public (download here). As I was travelling, I had to wait a couple of days before downloading, but finally got round to it this morning. I fired up a new machine in Hyper-V and got cracking.

The installation is pretty straight forward, and looks very much like the previous Windows installers.

 image

And even with only 1GB of memory, the installation took less than 8 minutes to complete.

image

The OS is responsive, the UI is clean and I love the snappable start menu. I look forward to playing with this new release a lot more over the next couple of weeks for some real impressions.

Related Posts with Thumbnails