05-11-2014 02:28 PM - edited 03-01-2019 01:38 PM
UCS Communities Login ID: robbeck
Twitter handle (optional): TechBeck03
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 [ X] No [ ]
Does the script run on an emulator - Yes [ X ] No [ ]
If yes which version? 2.2(x) for full compatibility
v2.5 Edit: Added a new check for the Firmware Auto Sync Policy (credit to Marcello Turano)
v2.4 Edit: Added support for Ucs PowerTool 2.x and fixed timestamp
v2.3 Edit: Fixed FC uplink SAN performance data and added single psu support
.DESCRIPTION
Script for polling multiple UCS Domains and creating an html report
of the domain inventory, configuration, and overall health
.PREREQUISITES
Powershell version 3.0 or higher
Connection to the internet
UCS PowerTool version 1.1.1 or higher
VIDEO TUTORIAL
.SCRIPT USAGE NOTES
Before generating the report select option 1) from the root menu
and connect to target UCS Domains. Cache domain credentials after
connecting to speed up future script executions.
You must have an active internet connection to view the report as it
streams some javascript and css files to build report
Use the UsedCache, RunReport, Silent, and Email switch options to automate
script execution (especially if scheduling script as a task)
Ex: .\UCS_Health_Check_v2.5.ps1 -UseCached -RunReport -Silent -Email user@domain.com
.REPORT USAGE NOTES
The generated html report supports multiple domains worth of data. Use the Domain
dropdown at the top of the page to switch between UCS Domains. Some of the table
entries can be clicked for a more detailed view. There are help icons with tooltips to
help explain the capabilities of each table.
Include your script here:
Items like this posted to Cisco Communities are available by simply downloading - no licensing.
tim
Hi Rob,
The script is working perfect manually, but when I try to automate I am getting the below error. can you please help. Thanks
ConvertTo-SecureString : The parameter is incorrect.
At C:\script\UCS_Health_Check_v2.5.ps1\UCS_Health_Check_v2.5.ps1:155 char:105
+ ... $credData[2] | ConvertTo-SecureString))
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [ConvertTo-SecureString], C
ryptographicException
+ FullyQualifiedErrorId : ImportSecureString_InvalidArgument_Cryptographic
Error,Microsoft.PowerShell.Commands.ConvertToSecureStringCommand
Error connecting to UCS Domain at 192.168.112.101 Press C to continue or any ot
her key to exit:
Hi Rob, Is there a trick to scheduling a task with thescript?
Anytime I use the PowerShell -File switch parameter it fails to read credentials from the cache, which makes it hard to schedule.
PowerShell -File .\UCS_Health_Check_v2.5.ps1 -UseCached
Error connecting to UCS Domain at XXXXXXX Press C to continue or any other key to exit:
I was able to correct my issue by adding the below to the top of the script.
Import-Module Cisco.IMC
Import-Module Cisco.Ucs.Core
Import-Module Cisco.UCS.DesiredStateConfiguration
Import-Module Cisco.UCSManager
Import-Module Cisco.UCS.Core
Hi Brandon Beck,
I am unable to schedule health check script with window , Can you please assist me to get steps ..
Thanks
Sunil
I was able to correct this issue by adding the below to the top of the script.
Import-Module Cisco.IMC
Import-Module Cisco.Ucs.Core
Import-Module Cisco.UCS.DesiredStateConfiguration
Import-Module Cisco.UCSManager
Import-Module Cisco.UCS.Core
Hi Rob,
This script is awesome!..
Great one, I have automated this as well
I am able to generate the report, but there is problem in sending emails .
Can you please help with the email function which throws the error as below.
Exception setting "From": "Value cannot be null.
Parameter name: value"
At C:\Scripts\UCS_Health_Check_v2.5.ps1:2305 char:3
+ $msg.From = $mailfrom
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
Exception calling "Send" with "1" argument(s): "The SMTP host was not specified."
At C:\Scripts\UCS_Health_Check_v2.5.ps1:2317 char:3
+ $smtp.Send($msg)
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Thanks!
You need to remove the # from the email settings section of the script.
Can we Zip the HTML file before sendign this via email? I have a larg environement and my SMTP preventing me to send this report due to a size limitation.
can anyone assist?
How did you get it automated? I can run just fine from powershell console but when I schedule as a Task it says it runs for a few minutes the goes away.
\UCS_Health_Check_v2.5.ps1 -UseCached -RunReport -Silent -Email user@domain.com
Has anyone been able to run this as a Scheduled Task?
When I launch powershell and paste in .\UCS_Health_Check.ps1 -UseCached -RunReport -Silent
It runs just fine.
But when I run it from Task Scheduler it doesn't show an error but shows the task completed within a couple seconds and does nothing.
Hi Robert, adding the below to the top of the script allowed me to schedule
the script.
Import-Module Cisco.IMC
Import-Module Cisco.Ucs.Core
Import-Module Cisco.UCS.DesiredStateConfiguration
Import-Module Cisco.UCSManager
Import-Module Cisco.UCS.Core
Do you have your task scheduled as powershell.exe and the parameter as -file "D:\Documents\Scripts\UCSCheck\UCS_Health_Check.ps1 -UseCached -RunReport -Silent"
The only difference i see is that i didn't use quotes, rather shortnames
Program
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Argument
-command C:\temp\UCS_HE~2.PS1 -UseCached -RunReport -Silent
Thanks man, I think that did it.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: