Get-UcsFault One-Liner

Document created by joshua.barton on Apr 18, 2014Last modified by joshua.barton on Apr 20, 2014
Version 2Show Document
  • View in full screen mode

UCS Communities Login ID: Joshua.Barton

Have you read the Official Rules of the Contest and do you accept the terms and conditions     Yes  [ x ]    No  [   ]

Are you a Cisco employee                                                                                                                          Yes  [  ]    No  [ x ]

Does the script run on an emulator -                                                                                                          Yes [   ]    No  [  ]

          If yes which version? _______________


Ran in a version 2.1(1a) UCS System (Not Emulator)


Include your script here:


# Script is wrapped in the body statement of Send-MailMessage.

# Gathers all uncleared faults, sorts them by severity, convert the output to

# HTML and use Out-String to make Send-MailMessage happy.

# Update: Added formatting to increase legibility.


Send-MailMessage -From "" -To "" -Subject "UCS Faults" -SmtpServer "" -BodyAsHtml -Body (Get-UcsFault | Where { $_.Severity -ne "cleared" } | Select-Object Dn, Severity, Descr, Created | Sort Severity -Descending | ConvertTo-HTML -Head "<style type='text/css'>BODY{background-color:#f0f0f0;}TH,TD{border-width: 1px;padding: 10px;border-style: solid;border-color: black;border-collapse: collapse;}</style>" | Out-String)