Solved

SCOM Heartbeat Failures - powershell script ping

Posted on 2014-03-14
4
1,214 Views
Last Modified: 2014-03-31
HI Guys,

I am getting serveral SCOM alerts via email in regards to hearbeat failure it looks like this

Alert: Health Service Heartbeat Failure
Source: SCO-VEC-03.Qr.DS.qqqq.com Path: Microsoft.SystemCenter.AgentWatchersGroup
Last modified by: System
Last modified time: 3/12/2014 11:25:39 PM Alert description: The System Center Management Health Service on computer SCO-VEC-03.Qr.DS.qqqq.com failed to heartbeat.

there are approximately 100 of these emails and I need to copy the machine name, in this case its SCO-VEC-03.Qr.DS.qqqq.com, put them all in a text file called heartbeat.txt then run the command:

Get-Content heartbeat.txt | % {Test-Connection -ComputerName $_ -Count 1}

Is there a code I can use to copy those machines names automatically from the alerts, instead of me having to copy and paste each and every one of them?
0
Comment
Question by:Kay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 18

Assisted Solution

by:x-men
x-men earned 500 total points
ID: 39928937
0
 

Author Comment

by:Kay
ID: 39929523
thanks x-men!

I have created this code but it doesn't work, its because of the white space, I imported it in a txt file and remove the white spaces after the machines names then it work, is there a workraround the whitespace issue?

Get-SCOMAlert -Name *heartbeat* | % {test-connection -computername $_ -count 1}

Open in new window

0
 
LVL 18

Accepted Solution

by:
x-men earned 500 total points
ID: 39929918
yes:

$computername.Tostring().Substring(0,$computername.Tostring().IndexOf(" ")))


my test:

>$x="abc "
>"!$x!"
!abc !
> "!$($x.Substring(0,$x.IndexOf(" ")))!"
!abc!
0
 
LVL 8

Expert Comment

by:Leon Taljaard
ID: 39930948
Hi

If all you would like to do is test the connectivity of this server then you could also look at the ping MP from OpsLogix, they have a ping management pack which can show you a visual representation of the ping response of a specific server with minimal setup.

Have a look here

http://www.opslogix.com/download-ping-management-pack
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question