Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SCOM Heartbeat Failures - powershell script ping

Posted on 2014-03-14
4
Medium Priority
?
1,281 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 2000 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 2000 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

Looking for the Wi-Fi vendor that's right for you?

We know how difficult it can be to evaluate Wi-Fi vendors, so we created this helpful Wi-Fi Buyer's Guide to help you find the Wi-Fi vendor that's right for your business! Download the guide and get started on our checklist today!

Question has a verified solution.

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

By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

609 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