Solved

SCOM Heartbeat Failures - powershell script ping

Posted on 2014-03-14
4
1,123 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
  • 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
This article will help you understand what HashTables are and how to use them in PowerShell.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now