Dom
 New Member Posts:5

 |
| 12 Aug 2010 05:40 AM |
|
Hello guys, i have a little problem and don´t know how to solve it. I have googled for that, but i could not find anything useful.
I want to make a script which returns the health (errors and warnings) of all computers which are monitored through SCOM. So the output should be something like that: Servername | Domain | IP Adress | Health | Problem
I have tried to compare the id from get-agent with the id of get-state but it doesn´t work because the ids do not match.
Overall the script is very complicated. Is there another easier way to solve this problem?
|
|
|
|
|
Marco Shaw (MVP)
 Veteran Member Posts:1647

 |
| 12 Aug 2010 06:13 PM |
|
I'll help you... Now, my lab environment (provided by a friend) isn't accessible right now. In a big hurry? |
|
Marco
*Microsoft MVP - Windows PowerShell
https://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
*Blog - http://marcoshaw.blogspot.com |
|
|
Dom
 New Member Posts:5

 |
| 12 Aug 2010 11:46 PM |
|
I´m not really in a hurry. But it would be good, if you have a solution for me until the 23th of august. :)
|
|
|
|
|
Marco Shaw (MVP)
 Veteran Member Posts:1647

 |
| 13 Aug 2010 02:55 PM |
|
I still don't have access. I'll have you something by Tuesday of next week though. |
|
Marco
*Microsoft MVP - Windows PowerShell
https://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
*Blog - http://marcoshaw.blogspot.com |
|
|
Marco Shaw (MVP)
 Veteran Member Posts:1647

 |
| 20 Aug 2010 08:35 AM |
|
I'm sorry, I have not been able to get access to a lab environment, and my backup plan also seems to have failed. I might still get something by Sunday night... I'll keep trying. |
|
Marco
*Microsoft MVP - Windows PowerShell
https://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
*Blog - http://marcoshaw.blogspot.com |
|
|
Marco Shaw (MVP)
 Veteran Member Posts:1647

 |
| 20 Aug 2010 11:55 AM |
|
OK, I've made some progress... I haven't looked at this in detail, but this might help, you may have to go with an approach like this: SCOM PS>get-monitoringclass|where{$_.name -eq "microsoft.windows.server.2008.computer"}|get-monitoringobject|get-state |
|
Marco
*Microsoft MVP - Windows PowerShell
https://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
*Blog - http://marcoshaw.blogspot.com |
|
|
Dom
 New Member Posts:5

 |
| 23 Aug 2010 12:25 AM |
|
Very well thank you. But i have another problem. How do i get the name and ip of a server who has an error? |
|
|
|
|
Marco Shaw (MVP)
 Veteran Member Posts:1647

 |
| 23 Aug 2010 05:01 AM |
|
Give this a try: PS>get-monitoringclass|where{$_.name -eq "microsoft.windows.server.2008.computer"}|get-monitoringobject|select @{n="state";e={$_|get-state|select -exp healthstate}},@{n="ipaddress";e={$_|select -exp *ipaddress}},displayname|where{$_.state -eq "Error"} I'll have to explain it later... ;-) |
|
Marco
*Microsoft MVP - Windows PowerShell
https://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
*Blog - http://marcoshaw.blogspot.com |
|
|
Dom
 New Member Posts:5

 |
| 24 Aug 2010 02:27 AM |
|
That is perfect I am very impressed. The problem for me was the piping and the statements of the selects. And again, thank you very much for your help. I have learned alot from your script :) |
|
|
|
|