Automation

 View Only
Expand all | Collapse all

Help creating HTML report from PowerShell script

  • 1.  Help creating HTML report from PowerShell script

    Posted Dec 19, 2011 07:57 PM

    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



  • 2.  RE: Help creating HTML report from PowerShell script
    Best Answer

    Posted Dec 21, 2011 08:25 AM
      |   view attached

    Hi Arnold, creating such a report will involve a lot of HTML and CSS coding, which is not my forte btw :smileygrin:

    The best example is of course Alan's vCheck script.

    In the attached script I borrowed/stole the HTML and CSS code from Alan's script.

    The result is far of from what you envisage, but I hope it will give you at least a framework for further customisation.

    Attachment(s)

    ps1
    html-report.ps1   8 KB 1 version


  • 3.  RE: Help creating HTML report from PowerShell script

    Posted Dec 21, 2011 09:44 PM

    Thank you LucD,

    I actually had an eureka moment yesterday morning and finally saw data in a HTML output. Once I figured out what I was doing wrong, everything fell into place.

    All credit still goes to you and Alan, if it wasn't for your sites and support, I would not have been able to figure out how everything fits together.

    I attached the .ps1 file I used and the .htm file that got generated from it.

    Thanks again.



  • 4.  RE: Help creating HTML report from PowerShell script

    Posted Dec 21, 2011 10:51 PM

    Great, glad you figured it out. That HTML output looks fantastic. There should be a module that makes producing HTML output easier for non-HTML people like me ;-)



  • 5.  RE: Help creating HTML report from PowerShell script

    Posted Jul 06, 2017 08:06 AM

    Hi, I am unable to get the html output on your script. However, scripts login to the vcenter and status is getting updated in the powershell screen. TIA



  • 6.  RE: Help creating HTML report from PowerShell script

    Posted May 12, 2019 12:06 PM

    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



  • 7.  RE: Help creating HTML report from PowerShell script

    Posted Jul 01, 2021 11:54 AM

    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



  • 8.  RE: Help creating HTML report from PowerShell script

    Posted Jan 20, 2012 07:14 PM

    One of the best scripts I've seen... HTML output makes it that much better.

    One question though, I have a couple clusters that arent reporting any Disk Space/Consumed Disk Space/Available Disk Space. Just zeroing out.... I thought it was because the DS's were NFS, but thats not the case, then maybe the clusters were part of a vSphere 5.0 cluster, but not the case either.

    Any reason why?



  • 9.  RE: Help creating HTML report from PowerShell script

    Posted Jan 23, 2012 03:20 PM

    Hello Justin,

    The majority of the code was from Virtu-Al’s vChek 5.0 script but also have code that I found by LucD.

    $data = Get-Datastore -VMHost $esxi | where {$_.Type -eq "VMFS" -and (Get-View $_).Summary.MultipleHostAccess}

    The script is only looking for datastores that are VMFS not NFS. I never tried it with NFS to see if it would pull any statistics.

    Hope that helps.



  • 10.  RE: Help creating HTML report from PowerShell script

    Posted Jan 23, 2012 03:55 PM

    Change

    $data = Get-Datastore -VMHost $esxi | where {$_.Type -eq "VMFS" -and (Get-View $_).Summary.MultipleHostAccess}

    $MyReport += (Get-ClusterDetail1 "Number Of Hosts: " ($esxi | Measure-Object).Count) , (Get-ClusterDetail2 "Total SAN Disk Space (GB): " ("{0:f2}" -f (($data | where {$_.Type -eq "VMFS"} | Measure-Object -Property CapacityMB -Sum).Sum / 1KB)))

    To

    $data = Get-Datastore -VMHost $esxi | where {$_.Type -eq "NFS" -and (Get-View $_).Summary.MultipleHostAccess}

    $MyReport += (Get-ClusterDetail1 "Number Of Hosts: " ($esxi | Measure-Object).Count) , (Get-ClusterDetail2 "Total SAN Disk Space (GB): " ("{0:f2}" -f (($data | where {$_.Type -eq "NFS"} | Measure-Object -Property CapacityMB -Sum).Sum / 1KB)))

    Will report on datastores with a Type of NFS only or you can remove the highlighted code to get all datastore Types that connect to Multiple Hosts.

    $data = Get-Datastore -VMHost $esxi | where {$_.Type -eq "NFS" -and (Get-View $_).Summary.MultipleHostAccess}

    $MyReport += (Get-ClusterDetail1 "Number Of Hosts: " ($esxi | Measure-Object).Count) , (Get-ClusterDetail2 "Total SAN Disk Space (GB): " ("{0:f2}" -f (($data | where {$_.Type -eq "NFS"} | Measure-Object -Property CapacityMB -Sum).Sum / 1KB)))



  • 11.  RE: Help creating HTML report from PowerShell script

    Posted Jan 24, 2012 06:39 AM

    Thanks for the quick response...

    EDIT : Im editing my reply because I cant read haha... I wanted to get the data regardless of VMFS or NFS, and re-read your reply and got it to work.

    Thanks again!    



  • 12.  RE: Help creating HTML report from PowerShell script

    Posted Jan 24, 2012 10:59 AM

    Great!

    How to send the html report as an email attachment instead of in the email body?



  • 13.  RE: Help creating HTML report from PowerShell script

    Posted Jan 24, 2012 01:41 PM

    Hello Fred,

    I wasn't quite sure myself but did a google search and found a solution.

    Add the highlighted code to Function Send-SMTPmail

    Function Send-SMTPmail($to, $from, $subject, $smtpserver, $body, $attachment) {
    $mailer = new-object Net.Mail.SMTPclient($smtpserver)
    $msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body)
    $att = New-Object Net.Mail.Attachment($attachment)
    $msg.Attachments.Add($att)
    $msg.IsBodyHTML = $true
    $mailer.send($msg)
    }

    if ($SendEmail) {
    Write-ToConsole "... Sending Email of Weekly Report - VMware Cluster Resource Summary to $EmailTo"
    send-SMTPmail $EmailTo $EmailFrom "Weekly Report - VMware Cluster Resource Summary" $SMTPServer "The report has been attached to this e-mail" $Filename

    The highlighted part of if ($SendEmail) { is the $body and $Filename is now the $attachment

    My original solution was to save the report to a network share that everyone had access to, and got backed up, and have the body of the e-mail be a link to the report.

    $Filename = "\\Server\Share\Logs\VMware\WeeklyReport-VMwareClusterResourceSummary" + "_" + $Date.Month + "-" + $Date.Day + "-" + $Date.Year + "_" + $Date.Hour + "-" + $Date.Minute + "-" + $Date.Second + ".htm"

    FYI

    Make sure both $DisplayToScreen and SendEmail are set to $true, even if it's ran as a Scheduled Task, for $Filename to be created.

    $DisplayToScreen = $true
    $SendEmail = $true



  • 14.  RE: Help creating HTML report from PowerShell script

    Posted Jan 25, 2012 02:52 PM

    Thanks a lot Arnold!

    Working great!

    regards

    fred



  • 15.  RE: Help creating HTML report from PowerShell script

    Posted Mar 09, 2012 12:58 AM

    Is there a way to add multiple vCenter servers and have it report accuratley?

    Right now I've added:

    $vcenters = @("vcenter1")
    $vcenters = @("vcenter2")
    $vcenters = @("vcenter3")

    It doesnt seem to pull the information consistently?



  • 16.  RE: Help creating HTML report from PowerShell script

    Posted Mar 09, 2012 05:58 AM

    To create an array with the vCenters you could use

    $vcenters = "vcenter1","vcenter2","vcenter3"

    or

    $vcenters = @()

    $vcenters += "vcenter1"

    $vcenters += "vcenter2"

    $vcenters += "vcenter3"

    Make sure your PowerCLI is configured for multi-mode

    Set-PowerCLIConfiguration -DefaultVIServerMode multiple

    that way you can have connections to multiple vCenters



  • 17.  RE: Help creating HTML report from PowerShell script

    Posted Mar 09, 2012 06:22 AM

    I tried adding the vcenters to one line, just didnt have them in " "

    This did the trick:

    $vcenters = "vcenter1","vcenter2","vcenter3"

    Once again... thanks :smileyhappy:



  • 18.  RE: Help creating HTML report from PowerShell script

    Posted Mar 09, 2012 07:42 AM

    Is there an easy way to get this to export all the data to excel or a .csv file? Excel would be preferred...     



  • 19.  RE: Help creating HTML report from PowerShell script

    Posted Mar 09, 2012 09:41 AM

    Hi justin,

    There is an easy way to create an output file - just pipe the content of your report to Out-File. For example, at the end of the report script after you have sent the e-mail with the report (or instead of sending the email) put something like this in place:

    $MyReport | Out-File C:\report.csv

    Is that what you are looking for?



  • 20.  RE: Help creating HTML report from PowerShell script

    Posted Mar 09, 2012 10:57 AM

    Wouldn't it be better to use Export-Csv if you want to create a CSV file ?

    $MyReport | Export-Csv C:\report.csv -NoTypeInformation -UseCulture


  • 21.  RE: Help creating HTML report from PowerShell script

    Posted Mar 09, 2012 11:27 AM

    Yes of course! I often forget about the Export-CSV cmdlet. Is that UseCulture parameter used to use a delimiter other than comma (for different culture settings) then? That is one thing I have actually been caught on before - not having the "right culture" settings in figures.



  • 22.  RE: Help creating HTML report from PowerShell script

    Posted Mar 09, 2012 12:09 PM

    That is correct, it makes Export-Csv select the culture specific seperator.



  • 23.  RE: Help creating HTML report from PowerShell script

    Posted Mar 10, 2012 06:53 AM

    Where in the script do I place the Export-Csv?

    I'd like it to still output the file to HTML, just because it looks great, but have the output to CSV so I can automate some reports based on the spreadsheet.        



  • 24.  RE: Help creating HTML report from PowerShell script

    Posted Mar 10, 2012 10:06 AM

    If you have the required data in an array, you can, at the end of the script, direct it to HTML and a CSV file.

    $array | ConvertTo-Html | Out-File .\report.html

    $array | Export-Csv .\report.csv -NoTypeInformation -UseCulture



  • 25.  RE: Help creating HTML report from PowerShell script

    Posted Mar 13, 2012 06:12 PM

    LucD,

      Is it Possible to pull the Weekly report for ESXi Host performance in graphical format per Cluster wise.PFA

    thanks

    vmguy



  • 26.  RE: Help creating HTML report from PowerShell script

    Posted Mar 13, 2012 07:00 PM

    These graphs are made by an extension in your vCenter.

    The methods used are unfortunately not public, so it will be a bit harder to produce such graphs I'm afraid. :smileysad:



  • 27.  RE: Help creating HTML report from PowerShell script

    Posted Mar 13, 2012 08:40 PM

    LucD,

       Thanks for your reply.

    vmguy



  • 28.  RE: Help creating HTML report from PowerShell script

    Posted Mar 21, 2012 06:21 PM

    I dont have anything put into an array. Basically what I do now is copy all the contents from the html thats generated then paste it into an excel spreadsheet. I was looking to avoid that step or make it easier. :smileyhappy:



  • 29.  RE: Help creating HTML report from PowerShell script

    Posted Mar 21, 2012 06:32 PM

    Are you saying that the script doesn't place anything in the array ?



  • 30.  RE: Help creating HTML report from PowerShell script

    Posted Mar 21, 2012 06:36 PM

    This is where my lack of scripting knowledge may come into play :smileyhappy:

    Im not sure what an "array" would be in scripting terms... and as far as the script, I only have the lines you mentioned above that have $array in the code.



  • 31.  RE: Help creating HTML report from PowerShell script

    Posted Mar 21, 2012 07:28 PM

    I can see how those 2 lines that use the $array variable could be confusing.

    Those 2 lines were the end of a reporting script, not the complete script.

    As a (very simple) sample

    # Fill the $array with data that needs to go into the report
    $array = Get-VMHost | Select Name,Build # Convert the contents of $array to HTML code and write it to a file
    $array
    | ConvertTo-Html | Out-File .\report.html
    #
    Display the HTML file
    Invoke-Item .\report.html

    First the script places some data in the variable $array and then the output is created.

    Note that the part of the script that fills $array with data can be very complex (there are ample examples available in other threads).

    I hope this clarifies it a bit more.



  • 32.  RE: Help creating HTML report from PowerShell script

    Posted Mar 21, 2012 08:43 PM

    I was hoping to just take the contents of the whole HTML and export that to a excel... is that possible?

    If not, how would I determine what data to put into the report/$array?



  • 33.  RE: Help creating HTML report from PowerShell script

    Posted Mar 21, 2012 09:50 PM

    Why would you export HTML code to Excel ?

    Then you better use the Export-Csv cmdlet and export the $array to a CSV file.

    $array | Export-Csv .\report.csv -NoTypeInformation -UseCulture


  • 34.  RE: Help creating HTML report from PowerShell script

    Posted Aug 21, 2017 04:56 PM

    LucD,

    It looks like you were on the correct track and I couldn't see the performance data in vCenter and getting "request processing is restricted by administrator, so that explains the issues. I used the KB below to resolve the issues and everything looks good now. One more question, is there a way to make the text in just the emailed report smaller? I tried changing line 41 to (FONT-SIZE: 75%), but this made the HTML report file created much smaller too, which I didn't want to do.

    https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2107096



  • 35.  RE: Help creating HTML report from PowerShell script

    Posted Aug 21, 2017 06:26 PM

    Both reports (screen & email) are generated from the same $MyReport variable.

    Try changing it for just the mail part.

    Change those last lines into

    if ($SendEmail) {

        Write-ToConsole "... Sending Email of Weekly Report - VMware Cluster Resource Summary to $EmailTo"

        $MyReport = $MyReport.Replace('FONT-SIZE: 100%;','FONT-SIZE: 75%;')

        send-SMTPmail $EmailTo $EmailFrom "Weekly Report - VMware Cluster Resource Summary" $SMTPServer $MyReport

    }



  • 36.  RE: Help creating HTML report from PowerShell script

    Posted Aug 21, 2017 06:49 PM

    That did the trick, thanks LucD!



  • 37.  RE: Help creating HTML report from PowerShell script

    Posted Sep 29, 2017 04:00 PM

    One more question, how can I get this to run as a scheduled task? I tried several ways to run this via Windows Task Scheduler, and added "Get-Module -Name VMware* -ListAvailable | Import-Module" to the script, but then the output seems to change if I dont run it manually via PowerCLI.



  • 38.  RE: Help creating HTML report from PowerShell script

    Posted Sep 29, 2017 04:16 PM

    What exactly changed in the output?



  • 39.  RE: Help creating HTML report from PowerShell script

    Posted Sep 29, 2017 08:54 PM

    I did a little more testing and it appears to be more of a issues with getting a PowerCLI script to execute via Task Scheduler. Do you have any recommendations on how to get a PowerCLI script to successfully run via Task Scheduler?



  • 40.  RE: Help creating HTML report from PowerShell script

    Posted Sep 29, 2017 09:26 PM

    If you're on PowerCLI 6.5.1 or later, normally auto-loading will make sure the PowerCLI modules get loaded (no more need to use Add-PSSnapin cmdlets in a scheduled script).

    You will need to do a Connect-VIServer in the scheduled script, and you need to avoid any interactivity in your script.

    If the script doesn't perform as expected, try seeing what happens with the Start-Transcript and Stop-Transcript cmdlets



  • 41.  RE: Help creating HTML report from PowerShell script

    Posted Oct 02, 2017 07:38 PM

    Perfect, thanks again for the help LucD!



  • 42.  RE: Help creating HTML report from PowerShell script

    Posted Aug 20, 2017 07:45 PM

    Is there anyway of adding logging into this script, to see why things arent working?

    I have one vCenter server and is able to pull all stats from two clusters, but I have one additional cluster and its able to pull everything except for the 7 day min, avg, max for memory and CPU info. For just this one cluster, the vales reported for just CPU and memory are blank.

    Thanks!



  • 43.  RE: Help creating HTML report from PowerShell script

    Posted Aug 21, 2017 04:33 AM

    To start diagnosing, do you see the counters, with values, under the Performance tab on the cluster?



  • 44.  RE: Help creating HTML report from PowerShell script

    Posted Jul 01, 2021 11:55 AM

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