VMware Cloud Community
ArnoldSlick
Contributor
Contributor
Jump to solution

Help creating HTML report from PowerShell script

Hello,

I am looking for help taking a working script and having it create a HTML report.

I found a script that LucD posted helping another poster gather cluster information which I have tweaked to gather the information I am looking for. The script works and will collect the needed information from all 3 of our vCenter Servers but I am struggling trying to get that information into a HTML report similar to what Alan has with vCheck5.

Below is the output from the script and have attached the script, WeeklyReport-VMwareClusterResourceSummary.ps1, and an example of what I am trying to archive, Weekly Report - VMware Cluster Resource Summary.htm.

Thank you for any help you can provide.

vCenter Server Name               : vCenter1
Datacenter Name                   : Desktop Datacenter 1
Cluster Name                      : Desktop Cluster 1
Number Of Hosts                   : 8
Number Of Datastores              : 19
Number Of Virtual Machines        : 625
Total Processor (Ghz)             : 314.98
Current Consumed Processor (Ghz)  : 143.69
Current Available Processor (Ghz) : 171.29
7 Day Minimum Processor Usage (%) : 13.90
7 Day Maximum Processor Usage (%) : 53.09
7 Day Average Processor Usage (%) : 28.80
Total Memory (GB)                 : 1023.97
Current Consumed Memory (GB)      : 782.86
Current Available Memory (GB)     : 241.12
7 Day Minimum Memory Usage (%)    : 59.43
7 Day Maximum Memory Usage (%)    : 75.41
7 Day Average Memory Usage (%)    : 66.38
Total Disk Space (GB)             : 14395.25
Current Consumed Disk Space (GB)  : 9948.26
Current Available Disk Space (GB) : 4446.99

43 Replies
JKoons
Contributor
Contributor
Jump to solution

Perfect, thanks again for the help LucD!

0 Kudos
aniltumuluri
Contributor
Contributor
Jump to solution

Hello, I'm getting below error and also i'm not getting email. Could you please check and replay would help me.

 

Get-VM : 5/12/2019 6:58:00 AM   Get-VM          Exception has been thrown by the target of an invocation.
At C:\Users\pa-anil.kumar\Desktop\WeeklyReport-VMwareClusterResourceSummary.ps1:9 char:24
+     $nvms = $cluster | Get-VM
+                        ~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VM], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

Get-VM : 5/12/2019 6:58:02 AM   Get-VM          Exception has been thrown by the target of an invocation.
At C:\Users\pa-anil.kumar\Desktop\WeeklyReport-VMwareClusterResourceSummary.ps1:9 char:24
+     $nvms = $cluster | Get-VM
+                        ~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VM], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

Get-VM : 5/12/2019 6:58:09 AM   Get-VM          Exception has been thrown by the target of an invocation.
At C:\Users\pa-anil.kumar\Desktop\WeeklyReport-VMwareClusterResourceSummary.ps1:9 char:24
+     $nvms = $cluster | Get-VM
+                        ~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VM], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

Get-VM : 5/12/2019 6:58:10 AM   Get-VM          Exception has been thrown by the target of an invocation.
At C:\Users\pa-anil.kumar\Desktop\WeeklyReport-VMwareClusterResourceSummary.ps1:9 char:24
+     $nvms = $cluster | Get-VM
+                        ~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VM], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

 

vCenter Server Name               : pwil0729vc01
Datacenter Name                   : HQ - PIL072VDC01
Cluster Name                      : IL072_CLUSTER01
Number Of Hosts                   : 2
Number Of Datastores              : 0
Number Of Virtual Machines        : 4
Total Processor (Ghz)             : 95.96
Current Consumed Processor (Ghz)  : 10.05
Current Available Processor (Ghz) : 85.91
7 Day Minimum Processor Usage (%) : 10.17
7 Day Maximum Processor Usage (%) : 17.12
7 Day Average Processor Usage (%) : 11.34
Total Memory (GB)                 : 639.82
Current Consumed Memory (GB)      : 241.22
Current Available Memory (GB)     : 398.60
7 Day Minimum Memory Usage (%)    : 37.82
7 Day Maximum Memory Usage (%)    : 37.94
7 Day Average Memory Usage (%)    : 37.92
Total Disk Space (GB)             : 0.00
Current Consumed Disk Space (GB)  : 0.00
Current Available Disk Space (GB) : 0.00

vCenter Server Name               : pwil0729vc01
Datacenter Name                   : YL - PCA150VDC01
Cluster Name                      : CA150_CLUSTER01
Number Of Hosts                   : 3
Number Of Datastores              : 0
Number Of Virtual Machines        : 15
Total Processor (Ghz)             : 219.62
Current Consumed Processor (Ghz)  : 20.08
Current Available Processor (Ghz) : 199.54
7 Day Minimum Processor Usage (%) : 8.04
7 Day Maximum Processor Usage (%) : 15.47
7 Day Average Processor Usage (%) : 9.91
Total Memory (GB)                 : 1661.29
Current Consumed Memory (GB)      : 429.59
Current Available Memory (GB)     : 1231.71
7 Day Minimum Memory Usage (%)    : 25.22
7 Day Maximum Memory Usage (%)    : 27.09
7 Day Average Memory Usage (%)    : 25.73
Total Disk Space (GB)             : 0.00
Current Consumed Disk Space (GB)  : 0.00
Current Available Disk Space (GB) : 0.00

vCenter Server Name               : pwil0729vc01
Datacenter Name                   : YL - PCA150VDC01
Cluster Name                      : CA150_CLUSTER02
Number Of Hosts                   : 2
Number Of Datastores              : 0
Number Of Virtual Machines        : 56
Total Processor (Ghz)             : 119.86
Current Consumed Processor (Ghz)  : 7.61
Current Available Processor (Ghz) : 112.25
7 Day Minimum Processor Usage (%) : 6.02
7 Day Maximum Processor Usage (%) : 19.40
7 Day Average Processor Usage (%) : 7.30
Total Memory (GB)                 : 383.50
Current Consumed Memory (GB)      : 278.87
Current Available Memory (GB)     : 104.63
7 Day Minimum Memory Usage (%)    : 73.30
7 Day Maximum Memory Usage (%)    : 77.78
7 Day Average Memory Usage (%)    : 76.47
Total Disk Space (GB)             : 0.00
Current Consumed Disk Space (GB)  : 0.00
Current Available Disk Space (GB) : 0.00

vCenter Server Name               : pwil0729vc01
Datacenter Name                   : MX - PMEX01VDC01
Cluster Name                      : MEX01_CLUSTER02
Number Of Hosts                   : 3
Number Of Datastores              : 2
Number Of Virtual Machines        : 31
Total Processor (Ghz)             : 139.03
Current Consumed Processor (Ghz)  : 6.65
Current Available Processor (Ghz) : 132.37
7 Day Minimum Processor Usage (%) : 4.74
7 Day Maximum Processor Usage (%) : 12.02
7 Day Average Processor Usage (%) : 6.50
Total Memory (GB)                 : 479.82
Current Consumed Memory (GB)      : 206.77
Current Available Memory (GB)     : 273.05
7 Day Minimum Memory Usage (%)    : 42.49
7 Day Maximum Memory Usage (%)    : 45.03
7 Day Average Memory Usage (%)    : 43.81
Total Disk Space (GB)             : 22344.50
Current Consumed Disk Space (GB)  : 8803.09
Current Available Disk Space (GB) : 13541.41

vCenter Server Name               : pwil0729vc01
Datacenter Name                   : CT - PBRA10VDC01
Cluster Name                      : BRA10_CLUSTER02
Number Of Hosts                   : 2
Number Of Datastores              : 1
Number Of Virtual Machines        : 9
Total Processor (Ghz)             : 110.11
Current Consumed Processor (Ghz)  : 4.91
Current Available Processor (Ghz) : 105.21
7 Day Minimum Processor Usage (%) : 3.61
7 Day Maximum Processor Usage (%) : 10.61
7 Day Average Processor Usage (%) : 6.57
Total Memory (GB)                 : 191.82
Current Consumed Memory (GB)      : 73.68
Current Available Memory (GB)     : 118.13
7 Day Minimum Memory Usage (%)    : 38.72
7 Day Maximum Memory Usage (%)    : 38.73
7 Day Average Memory Usage (%)    : 38.73
Total Disk Space (GB)             : 12284.00
Current Consumed Disk Space (GB)  : 7799.85
Current Available Disk Space (GB) : 4484.15

vCenter Server Name               : pwil0729vc01
Datacenter Name                   : PS - PCA151VDC01
Cluster Name                      : CA151_CLUSTER02
Number Of Hosts                   : 4
Number Of Datastores              : 0
Number Of Virtual Machines        : 17
Total Processor (Ghz)             : 119.66
Current Consumed Processor (Ghz)  : 6.03
Current Available Processor (Ghz) : 113.64
7 Day Minimum Processor Usage (%) : 5.35
7 Day Maximum Processor Usage (%) : 23.52
7 Day Average Processor Usage (%) : 11.76
Total Memory (GB)                 : 511.86
Current Consumed Memory (GB)      : 353.71
Current Available Memory (GB)     : 158.15
7 Day Minimum Memory Usage (%)    : 67.03
7 Day Maximum Memory Usage (%)    : 69.55
7 Day Average Memory Usage (%)    : 67.99
Total Disk Space (GB)             : 0.00
Current Consumed Disk Space (GB)  : 0.00
Current Available Disk Space (GB) : 0.00

0 Kudos
ashokboina
Contributor
Contributor
Jump to solution

Hi,

I got the HTML alert to my email ID, But I see (No colour code nor Comments), It is blank.

Can you share the Worked PS script with correct colour code

0 Kudos
ashokboina
Contributor
Contributor
Jump to solution

Can you share methe Corrected PS script, I get blank colour and with no comments to my email alerts

0 Kudos