Solved

SCOM Heartbeat Failures - powershell script ping

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I reset the password in Outlook? 10 33
Outlook 2016 10 36
scheduled email to be sent question. 3 24
Cannot exit IF statement in PowerShell 4 14
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
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…

740 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